Last week I took a support call from a woman having trouble emptying the trash on her Mac. She kept getting an error message saying that the item could not be deleted. Often the cause of this is an application or process that is still running and using that file. Other times it is because of permission problems. In both cases, where restarting the machine doesn’t help, I’ve found that securely emptying the trash will solve it. In her case, it didn’t work.

The solution was found in Terminal, the Mac command line utility. For the majority of Mac users you’ll never use this app—it will sit in your Utilities folder gathering digital dust. In truth, this is a good thing, as reckless use of Terminal can lead to some pretty serious consequences for your operating system. Though if you have the basics down, you can do a fair amount with your machine by bypassing the graphic interface that we all know and love. To delete your trash through Terminal, enter or copy and paste the following command line exactly:

sudo rm -rf ~/.Trash/*

To delete another user’s trash (user_name is the user’s short name) enter or copy and paste:

sudo rm -rf /Users/user_name/.Trash/*

Once entered, you’ll be asked for your administrator password and your trash will empty. If you have a large amount of files in there, it may take a bit. This command only works for trash contained on the root drive; any external or secondary volume connected would have a different path. In that case, the command line would be:

sudo rm -rf /Volumes/DriveName/.Trash/*

These commands will work for OS 10.5 and 10.6; I’m unsure of whether or not they will work with anything older than 10.5. It’s also entirely possible that upon the release of Lion, this solution will no longer work. Apple has changed some of the commands used in Terminal between 10.5 and 10.6, and could continue to change commands as the OS evolves. I have found that periodically the Trash icon on your dock will still look like it’s full even though the formerly stuck files are gone. Just right click and empty trash, and it will now look empty. Use this information at your own risk!