For those of you who are constantly met with the error that a disc image cannot be ejected because it is in use, read on for a quick little how-to with some Terminal code.
For this example, the disc Image that doesn’t want to leave will be titled “Stubborn Image.” Once you have the Finder error message tell you that you cannot eject the image, plug the following into Terminal:
lsof | grep Stubborn Image
The result should look like a variation of this:
bash 228 johndoe cwd DIR 14,4 4096 2 /Volumes/Stubborn Image
Word 1379 johndoe 24u REG 14,4 81 197704 /Volumes/Stubborn Image/C/Archiver/test.txtThis means that Word is using the file test.txt, so the first step should be to quit Word. Then, cd out of the Stubborn Image directory.
Voilà! Your Stubborn Image can be ejected!
I haven’t had an image to test this out with, but if you get the chance, tell us how it goes in the comments.
[Editor's Note: And be careful. Terminal isn't something you want to play around with if you don't know what you're doing.]
Via [Mac OSX Hints]


















Gotta wonder why Apple can't just tell you in the actual warning, yet they can in the Terminal.
Well, that's nice and incomprehensible. A little more detail would help.