When ejecting a volume in Mac OS X, you may be greeted with an error that says the disk is in use. Getting past this occasional annoyance is inconvenient, but not at all painful.
Just about every Mac user has seen this error at one point or another: “The disk “[VolumeName]” is in use and could not be ejected. Try quitting applications and try again.” This problem can occur when disconnecting a USB flash drive, an external hard disk, a shared network volume, etc. Granted, the error is accurate sometimes. There may indeed be a file on the volume that is still open and in use on your Mac, either by a running program or a background process. If you’re absolutely positive that no active applications are holding files hostage, though, Terminal can come to the rescue.
Launch Terminal (Applications > Utilities) and type the following command. Do not press Enter/Return to run it quite yet.
hdiutil eject -force
Now drag the troubled disk’s icon to the Terminal window. You can find this on the Desktop or in the Finder’s sidebar. The volume name and path should automatically be inserted into the command. Make sure there is a space after the “-force” part. Alternately, you can choose to type the path in manually. The final command should look like this, with “VolumeName” being your disk’s actual name:
hdiutil eject -force /Volumes/VolumeName
Press Enter/Return on your keyboard and, after a few seconds, Terminal should confirm the forced eject was successful. You can now safely disconnect your device.
In case you were wondering what this Terminal command means, here’s the quick rundown. The “hdiutil” command utilizes the DiskImages framework to control and manipulate disk images on your Mac. The rest is fairly self-explanatory… “eject -force” forces the volume to unmount and eject regardless of any open files it may contain.
For what it’s worth, Apple promises a more reliable disk eject function in the upcoming version of Mac OS X due next month. Here is what they have to say on the topic: “Snow Leopard improves the reliability of ejecting discs and external drives. Sometimes when an application or process is using the files on a drive, Mac OS X prevents you from ejecting it, but you don’t always know why. In Snow Leopard, you’ll get fewer of those errors and when you do get them, you’ll see exactly which application is using the drive, so you can quit it and eject the drive properly.”
November 1st, 2009, 11:06 PM
Thanks for this. Someone turned off my backup drive while it was in the middle of backing up and the mac refused to let it go until I followed your tip.