Empty trash without Preview (secretly) blocking

Alec Jacobson

January 24, 2013

weblog/

I run into this problem all the time. Even though Preview.app is not open, when I empty the trash I get warnings like:
The operation can't be completed because the item "some.pdf" is in use.
I'm not sure how it happens. But it seems some instance of Preview continues to run even after quitting or force quitting. I found this out by issuing:
sudo lsof ~/.Trash/some.pdf
This showed:
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF    NODE NAME
Preview 73409  ajx  txt    REG   14,2 18966290 4989399 /Users/ajx/.Trash/some.pdf
Then I knew to issue:
kill 73409
Then I could empty the trash with no errors.