We’ve all had it, that time when you try to empty your trash in OS X and the system tells you it can’t delete the files because they are “in use,” when as far as you are aware, they’re not. Frustrating isn’t it?
Around seven times out of ten, the file is actually linked to a program, and there is a legitimate reason for this annoying message. But often the file is not in use, you know it isn’t and yet the message is stubbornly persistent.
In this article we will be discussing the variety of ways you can get around this annoying message, empty the trash, and get on with your day.
Actually In Use
Sometimes, despite your false impression the file is done with, it is actually still “in use,” that is to say referenced by a program that is still running. Sometimes this can be as tenuous as a link to the file being in the recent files list in the program concerned. The way to make sure (and the first thing to check when this happens) is to close all other programs other than Finder and try emptying the trash again.
Note: A common problem is that a file you are trying to delete was actually from an open DMG disk image file. You have to eject or unmount the drive before you can delete the file. Nothing else you try to do to the file will work.
Most times this will clear the problem. But if it doesn’t, you have to get more creative.
No Really; Delete It
The second thing you can try is “Secure Empty Trash.” Hold down the Command key while pressing the Right Mouse Button, and Empty Trash on the popup menu will turn into Secure Empty Trash. Actually this is meant for deleting things that you don’t want to be recovered by disk recovery software, like personal financial information for example. It’s the digital equivalent of a shredder.
Sometimes, if the reason for the file hangup is a Finder crash or anomaly of some type, this Secure Empty Trash process will also hang. The way to get out of this and back to work is to Relaunch the Finder, which if the Finder has hung up will be an option on the popup menu if you hold down the Command key while using the Right Mouse Button on the Finder icon in the Dock.
When the Finder has refreshed, you might find that the trash is now empty.
Turn It Off, and Turn It On Again
Obviously, the old standard fallback ploy of rebooting your machine will sever any ties to any running program no matter how tenuous, so restarting your machine can also do the job. The files may still be in the trash after restart, so restart and then go back and empty the trash again and the files should be gone.
If All Else Fails
Most of the above options will usually do the job in the vast majority of cases. If the files still persistently refuse to be deleted, it may be that their permissions have gotten mixed through some accident of machine storage timing. Use Disk Utility to check and repair permissions on the offending disk.
Also you can “Get Info” (Right Button -> Get Info) on the offending files and set the permissions in the Get Info panel. You will have to click the small Lock icon and type your admin password before you can change them:
And if all that fails to turn up any anomalies and fix the problem, you also have the ultimate nuke button option of going into Terminal and deleting the files with a UNIX command.
Start Terminal from the Utilities folder. Navigate to the directory concerned using the
cd command. Use
ls to list each directory until you find the file. Then type:
rm (insert filename here)
rm command ReMoves the file. UNIX has no trash bin, so use this command wisely. Files deleted in this way will be GONE and gone for good.
Do you have any strategies for removing stuck files in OS X? Please share them with us in the comment below.
Photo Credit: Mikael Nordfeldth
Our latest tutorials delivered straight to your inbox