Sometimes emptying the trash in Finder takes significantly longer than just running rm -rf ~/.Trash. Is there some way to remap the "right click on trash in dock + click to empty trash" button to a script?

  • Welcome to AskDifferent! This site works better if there is just one question in a post. I've edited your question accordingly, feel free to ask additional questions separately.
    – nohillside
    Commented Apr 29, 2013 at 4:46
  • 2
    Understood, I'll submit the query about the "whys" of the issue separately.
    – Kaya
    Commented Apr 29, 2013 at 5:32

1 Answer 1


It would be easier to use an alias like this:

alias et="(shopt -s nullglob; find ~/.Trash /Volumes/*/.Trashes/501 -mindepth 1 -delete)"

rm -rf ~/.Trash/* doesn't work if the list of filenames is longer than getconf ARG_MAX, and it doesn't include files that start with a period. Deleting files in trash folders often requires root permissions though.

tell app "finder" to empty and trash -e (see hasseg.org/trash) can be run silently or on the background, but they are just as slow as emptying the trash from the GUI, and they make Finder display error dialogs if for example files are in use.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .