Sometimes I run into this issue; I'm trying to eject an SD card or USB stick, but my Mac just keeps telling me its in use and cannot be ejected ...
Messages like:
- The volume can't be ejected because it's currently in use.
- The disk "SomeUSBDisk" wasn't ejected because one or more programs may be using it.
- umount(/Volumes/SomeUSBDisk): Resource busy
Of course none of this is helpful ... what the heck is locking my device?
To find out, we can use disktutil.
In this example I'll try to eject /Volumes/SomeUSBDisk (replace "SomeUSBDisk" with the volume of the disk you're trying to eject).
The output is just an example, on your system this may be another process or application.
sudo diskutil unmount /Volumes/SomeUSBDisk
The output could look like this:
$ sudo diskutil unmount /Volumes/SomeUSBDisk
Password:
Volume SomeUSBDisk on disk2s1 failed to unmount: dissented by PID 326 (/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Support/mds_stores)
What we learn here is that our disk is locked by process 326 (PID 326). It even lists that this is the mds_stores tool.
If this is an application, then close it nicely. As an alternative you can try to kill it from the command line
sudo kill [PID]
or force kill it - be careful though, this is not recommended unless you know what you're doing.
sudo kill -9 [PID]
Example:
$ sudo kill -9 326
$ sudo diskutil unmount /Volumes/SomeUSBDisk
Volume SomeUSBDisk on disk2s1 unmounted
You disk can now be ejected ...