39

Emptying the trash in OS X can be a long process, especially If you have lots of items (like me). This is after 5 minutes:

enter image description here

Is there a way to quickly empty the trash, or make the process a whole lot quicker?

2
  • 2
    And why does it take so long in the first place anyway?
    – Thilo
    Sep 12, 2009 at 6:55
  • 2
    @Thilo: 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.
    – Chealion
    Sep 12, 2009 at 7:10

4 Answers 4

66

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.

6
  • sudo rm -rf ~/.Trash/* :)
    – atasoyh
    Aug 14, 2013 at 18:02
  • I didn't have to use sudo.
    – Chev
    May 15, 2014 at 20:44
  • 1
    Okay, this time I did. Depends on the permissions of the files thrown into the trash :)
    – Chev
    Jun 23, 2014 at 21:46
  • TL;DR: Triple-check your path when using re -rf, or you can f*** sh*t up.
    – Ivan Durst
    Oct 9, 2015 at 23:29
  • @IvanDurst Tru dat (I'm sure you meant rm not re!), even better is cd ~/.Trash then rm -rf *
    – drkvogel
    Jul 30, 2020 at 21:12
21

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.

1
  • This was the solution for me as well: defaults write com.apple.finder EmptyTrashSecurely -bool false
    – Marius
    Apr 25, 2012 at 21:31
4

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.

1

I use the following bash function to quickly empty trash.

emptytrash() {
    defaults write com.apple.finder EmptyTrashSecurely -bool false
    sudo rm -rf ~/.Trash/*
}

This can be added to your ~/.bash_profile or ~/.bashrc. Instructions on editing your bash files are here.

One benefit of using a bash function, apart from being easy to remember, is that you won't fat finger the rm -rf command.

Note, that depending on the content of your trash you may only be able to empty the trash as root - hence the sudo.

You can also reset the EmptyTrashSecurely back to true if you like.

Not the answer you're looking for? Browse other questions tagged or ask your own question.