Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a couple of files that I want to delete. So I select them and then do Move to Trash. However, when I do so I get this message:

Some of the items you are moving are in use by another application. Moving the items can cause problems with the application using them. Are you sure you want to move these items?

[Stop] [Continue]

My problem is that I can't find any applications that are using these files. I also tried to run

lsof | grep <part of filename>

But I couldn't see anything there either. What is going on? How can I find out why the file is "locked"? Is there anything similar to the LockHunter or Unlocker applications on Windows?

Note: I realize that I could probably try to just click continue instead of stop, but I'd like to know first and also learn if there is anything I can do. If I override whatever is holding them and deleting them, I won't have a way to test suggested solutions here :p

Note: For others reading this post; I have discovered that I do not have to use grep at all. I can just do lsof <filename>. Probably something most people know, but I didn't :p

share|improve this question
Tried sudo lsof? – Debilski Mar 2 '10 at 12:33
Did now, but didn't get anything then either. – Svish Mar 2 '10 at 13:14
Not a solution but Snow Leopard is supposed to have better information about why you can't do things with a file – Peter M Mar 2 '10 at 15:23
If we only had Intel... – Svish Mar 2 '10 at 15:42
up vote 3 down vote accepted

As Debilski notes, you might consider rerunning your command with sudo.

A likely culprit that I've often found is QuickLook: if you preview a file prior to trashing it there might be a relatively short lock on the file. If that's the case, once the lock is up (or you logout) you should be able to trash the file.

share|improve this answer
Is there a way I can "see" if that lock is present or not? And is there a way I can release it without logging out? – Svish Mar 2 '10 at 13:18
Using lsof is the only way to see it. The only way to release it is to quit the process that has the lock (which if it's a background GUI app is achieved by logging out). – Nerdling Mar 3 '10 at 2:54

If you'd like a GUI, look at WhatsOpen.

It's for MacOS 10.5 or greater (tested on 10.6 and 10.7) and it is available in the US Mac AppStore.

WhatsOpen is a MacOSX utility designed to aid you in determining what is holding your files open. There is a common OSX error when trying to eject removable media relating to files being in use. Often times your files are in use by Spotlight or some other internal system and you don’t even know what program to kill to free up the files and allow the media to eject. This utility makes that a snap. It also provides many other administrative features you may find useful.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .