5

I have a couple pictures I was looking through and deleting stuck in my trash (Mac OS X 10.6 latest) and finder tells me they are in use when I try to delete them.

I looked around online and found the lsof command in terminal (type lsod with a space, drag the file onto terminal, press enter) it told me the file was in use by:

 COMMAND     PID     FD
 Finder      7747    txt
 Finder      7747    13r
 mdworker    8685    txt
 quicklook   8822    13r
 quicklook   8822    14r

any idea what I can do about this? (other than restarting, this happens to me quite a bit), I'm wondering if this could be a bug as well.

Thanks for any help.

6 Answers 6

6

Running the command qlmanage -r in Terminal forces QuickLook to reload.

Hence releasing all locked files, now you will be able to empty your trash successfully.

1
  • Loading multiple items and even trying to kill the pid doesn't work but this command does it every time. Should be marked as the correct answer -JH
    – John
    Apr 2, 2016 at 2:51
4

Quick Look holds on to two items at a time. Annoying, but that can be used to your advantage. Simply select two new new files in Quick Look, and it will purge the old ones from its memory, allowing you to empty the trash.

1

Did you try Secure Empty Trash?

Right-click on the Dock, and hold the Command key. Then click on Secure Empty Trash. It works for me, sometimes.

Else, open up Terminal.app and type kill -9 <PID>

2
  • Wouldn't it be bad to kill finder?
    – user32791
    Mar 31, 2010 at 3:12
  • It shouldn't be bad. If you're uncomfortable using "kill", try holding Option while right-clicking on the Finder icon in the Dock. Then select the "Relaunch" menu item. Mar 31, 2010 at 5:42
1

Is it a bug? Kinda. In a perfect world, programs like quicklook wouldn't hold onto files, or would release them when notified that they're about to be deleted.

In this world, there's nothing wrong with terminating the offending programs (quicklook may be enough, the Finder doesn't usually cause problems that last more than a few seconds).

Either kill them in the Terminal, or use Activity Monitor to signal them to quit. Most programs, including the Finder, will relaunch automatically. kill -9 or Force Quit are overkill, unless they don't listen to the nice signal.

If you're still unable to delete them, logging out and back in is a quicker alternative to restarting that will release the files in the majority of cases.

0

Try first to reboot the machine. Otherwise, you'll have to force terminate the processes.

1
  • Rebooting works for sure
    – user32791
    Mar 31, 2010 at 3:11
0

You could just use rm to delete the file without killing anything. Just put in rm on Terminal, put in a space, and drag the file you want to delete onto the window

You must log in to answer this question.

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