Subscribe to MacYourself via RSSFollow MacYourself on Twitter

Fixing OS X’s “The disk is in use and could not be ejected” error

Fixing OS X's The disk is in use and could not be ejected error

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.”

10 Comments Have Been Posted (Leave Your Response)

WEIRD! I just had this problem the other day with a DVD!…the problem was that the dvd wasn’t showing up on my desktop or in the finder after it was unsuccessful the first try…weird

And my dvds weren’t playing either, sooo annoying.

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.

Thanks a lot!
I finally solved my problem.
Regards,
P. Rangel

This command didn’t work for me but I went to the “apple” on the top menu and selected “force quite” selected the finder and this worked.

Not sure if I typed in the terminal command incorrectly but found that this other way worked.

OMG! I’ve been up all night because I have all my files in the world on my hard drive and it wouldn’t eject properly. Took me an hour to find this web page, but once I did it finally took a few seconds.

I just got this error again in SNOW LEOPARD 10.6.7. And it did not tell me which app was using the memory stick (SanDisk SDHC ultraII 16GB). If apple really said this “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.” they did not live up to their words.

Force Eject, wether from terminal or from the GUI, is not really a solution to a problem. The OS isn’t releasing the disk for a reason, and it’s telling you what that reason is. The problem comes from in inability for the service using the disk to let go, and force ejecting can create new issues. (Like say you develop a habit of force ejecting and you force eject mid-backup cycle for time machine?)

More likely you have something wrong with your filesystem on the disk itself. Try running Disk Repair on it, or back up your files, reformat the drive and move the files back. In the long run, force ejecting is going to cause you to lose your valuable files. Don’t make a habit of it.

I searched and searched with no luck, until I found your post showing me how to use Terminal and “eject -force”. Thank you!! Worked perfectly.

Alan

Disk Utility -> Unmount also did the trick on OS X Lion

2nd Times a Charm: I see this a lot for my G4 Powerbook running 10.4.11, removing thumb drives comes up with this error message. I click “OK” in the error message window and immediately drag the the drive, again to the trash. It almost always works but if not I then check for applications using the drive. Don’t know if this works with DVDs, hard drives or backup drives but it works great with thumb drives.