Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

How can I empty the trash from the Terminal?

share|improve this question

3 Answers 3

up vote 21 down vote accepted

Another solution would be to create AppleScript containing the folowing code

tell application "Finder"
    empty the trash
end tell

save it as emptytrash for example and execute it via open emptytrash.app

or even better (as suggested by Chris) - execute:

osascript -e 'tell app "Finder" to empty'

Since trash is a Finder thing, this should be more compatible in the long run.

share|improve this answer
Thats a better solution though :) –  nuc Mar 24 '11 at 16:09
Directly from the command line: osascript -e 'tell app "Finder" to empty' (though you may want to put in a shell script to avoid having to get the syntax exactly right each time). –  Chris Johnsen Mar 25 '11 at 5:56

Trash is actually a hidden folder in the user's folder named .Trash

If you delete it's contents, you empty the trash. You can use

sudo rm -rf ~/.Trash/*

Just be careful with it so you don't delete something else ;)

share|improve this answer
But this will not delete .Trash on mounted media/network volumes. –  mspasov Mar 24 '11 at 16:04
Isn't using sudo unnecessary here? It seems unlikely that you'd have files not owned by you in your trash. –  Tanner Swett Mar 19 '13 at 18:50

A review of various command line tools, for managing the Trash from command line:


share|improve this answer
+1 Good article. –  mspasov Mar 24 '11 at 16:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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