Find File’s In Use On Disk Images 2


Find File’s In Use On Disk Images


One of the annoying things about using disk images or disks on a Mac is the inevitability of files been open when you want to eject the image. This means you can’t eject the disk, and you spent twenty minutes closing every application until you find one that is the culprit. Wouldn’t it be easier if there was a handy Terminal command you can input to find the open files.

To find the open files stopping you from ejecting a disk, open Terminal and type the following.

lsof +D /Volumes/Volume_Name

When it finishes running, might take a couple of seconds, you will have a result that looks similar to the one below.

iTunes  19385 James   14u   REG   14,5 12531440 8424 /Volumes/Homer/Music/iTunes Library.itl
iTunes  19385 James   15u   REG   14,5    12288  149 /Volumes/Homer/Music/iTunes Library Extras.itdb
iTunes  19385 James   17u   REG   14,5    32768  148 /Volumes/Homer/Music/iTunes Library Genius.itdb

Here you can see iTunes has three files that are open on the drive “Homer” as a result I could either close these files if I had access to them or close the application iTunes. As a result you can quickly see which files are open and actively take action on them. You can then try and eject the image with ease.

If you want a simplier way of doing this without using Terminal, check out What’s Keeping Me? It does the same thing as the Terminal shortcut but has a GUI interface.

If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.

Where To Next?

  • Subscribe To Mac Tricks And Tips