Quickly Empty Trash in Mac OS X

If you do it through the Terminal it is nearly always considerably faster:

rm -rf ~/.Trash/*

However it can be noted that this won't delete files that appear in your Trash from external hard drives, other partitions, etc. Those files are stored at /Volumes/NAME_OF_DEVICE/.Trashes/USER_ID where USER_ID is your user ID. (Usually 501 on a single user system) and you'll have to remove them using a second command. (sudo rm -rf /Volumes/*/.Trashes/501/* should do all of them for you)

As always when using rm -rf be completely sure the path you've typed into the Terminal is correct or you're liable to delete much more than you mean to. (eg. a space before a * is never good)

As to why the Finder takes so long, the Finder does some extra work of deleting files from all the devices attached to a computer, overriding permissions if necessary (using a subprocess called Locum), file stats, among others.


Check to see that "Empty trash securely" is not set. This erases files multiple times, so it takes much longer to delete.

The setting is in Finder's Preferences on the Advanced page. I've heard that sometimes a Snow Leopard upgrade accidentally sets this option.


If you need to empty the Trash of a mounted volume when using Finder in root mode (see http://yourmacguy.wordpress.com/2009/09/28/snow-leopard-root-finder/), it seems you can't just press Empty Trash in the Trash folder after pressing the icon (even ensuring the normal Finder isn't open). You will hear the trash emptying sound, but the trash does not get emptied.

Also, when browsing Finder in root mode doesn't show the hidden files and folders, even if you have enabled this option in your own user account.

Following Chealion's rm command with the asterisk at the end didn't seem to work for me. (Perhaps it was due to the double quotation marks at the ends; perhaps it needed the backslash format as demonstrated below.) Instead, I had to manually add the folder name; in my case:

sudo rm -rf /Volumes/Backup\ of\ Macintosh\ HD/.Trashes/0/_CCC\ Archives

(0 is the root user)

Which maps out to this, I guess:

sudo rm -rf /Volumes/[VOLUME NAME]/.Trashes/0/[FOLDER OR FILE NAME]

The asterisk wildcard not working might be a pain if you have many files and/or folders in the root Trash of a mounted volume.


CAUTION: Using Finder in root mode is definitely ill-advised for general use; use it in special circumstances. In my case, I wanted to backup and delete my Carbon Copy Cloner archived files (created in incremental backups), as just copying and pasting the "_CCC Archives" folder to a separate location threw up a load of errors while using Finder in normal user mode. I didn't have much luck with chown or cp under sudo either... so that's why I resorted to using root-mode Finder.


I am on Mac OS X 10.6.8 Snow Leopard, backing up my drive before the impending 10.7 Lion release.

Tags:

Macos

Trash

Speed