in use

The operation cannot be completed because the item is in use error in OSX

If you try and empty your trash can in OSX while a file is in use, you'll be presented with a message that looks like this:

This is not particularly useful, because if you're trying to delete a file you have worked on in multiple applications you won't know what is actually using the file. You can use terminal to force delete the trash, or resort to rebooting to get around this problem - but there's a better way. Open up terminal and enter the following command:

lsof | grep filename

Replace filename with part of or all of the filename that produced the error. You'll get some output like this:

In this case two applications have the problematic file open. PathFinder and Preview. If I close these applications and try and empty the Trash again it will allow the file to be deleted.

Subscribe to RSS - in use