This device could not be ejected
But Finder… I don't have any other applications open!

One of the things I can appreciate about learning how to use FreeBSD is that a lot of the knowledge can can also be used to work more productively in Mac OS X too because the commands are either identical or very similar. In many ways OS X and BSD are more similar than BSD and GNU/Linux.

One such function that Mac OS X shares with BSD is the umount command (Darwin man page, FreeBSD man page) which you can use to unmount drives that the Finder refuses to because it claims the drive is in use. Once you unmount a drive, you can safely unplug it.

To unmount a drive so you can eject it when the Finder refuses, launch Terminal.app from the /Applications/Utilities/ folder, then enter the following command including the quotation marks. Replace [DRIVE LABEL] with the name of the drive as you see it on your desktop including any spaces.

% umount "/Volumes/[DRIVE LABEL]"

If umount also refuses to eject the drive, there's a pretty good chance there still is an application using a resource on the drive. If you're positive you have no open files open on that drive and you're in a hurry, you can forcibly eject by using the -f option.

% umount -f "/Volumes/[NAME OF DRIVE]"

Take care when forcibly unmounting volumes!

If the Finder and umount refuse to unmount and eject a drive, they generally have a good reason. Attempt to close all open applications that could feasibly be using any data on the drive the attempt ejecting first.

You should only forcibly unmount a volume as an absolute last resort.

Troubleshooting

If you attempt to use umount and you get a "not currently mounted" error, then the name that Finder shows for the drive might not be the same name Mac OS X mounted it with. To check your drive volume names, fire up the Terminal again, then enter ls /Volumes/

Using the Terminal to display a list of mounted drives