How to force empty Trash on your Mac using Terminal

How to force empty Trash on your Mac using Terminal

If you're using a Mac, there has undoubtedly come a time when you've run into issues emptying Trash whether it be long wait times or freeze ups, especially if you're using the Secure Empty option.

If this has happened to you, there's actually a way around it using a simple command in Terminal. I've been using it for years and as far as I know, it'll work with not only Mountain Lion, but as far back as Tiger, if not even older versions.

Follow along and we'll get your Trash emptied in no time.

  1. Launch the Terminal app on your Mac by either searching for it in Spotlight or locating it in the Utilities folder under Applications.
  2. Type in the following command: "sudo rm -rf ~/.Trash/*" (without quotes) and then hit Enter on your keyboard.
  3. You may be prompted to enter your OS X user password. Type it in and then hit Enter on your keyboard.
  4. You should now be returned to the main user prompt in Terminal. Notice the Trash in your dock which should now be empty.

That's all there is to it. This trick is nifty for any time when the default empty trash process hangs up or if you've gotten a large amount of files to delete and the process seems to be taking forever. Just make sure you force quit trash from emptying before attempting to use Terminal to empty or the process will fail.

Have something to say about this story? Share your comments below! Need help with something else? Submit your question!

Allyson Kazmucha

Senior editor for iMore. I can take apart an iPhone in less than 6 minutes. I also like coffee and Harry Potter more than anyone really should.

More Posts

 

8
loading...
0
loading...
43
loading...
0
loading...

← Previously

Iterate 47: Chris Harris and Wonders of the Universe

Next up →

Do it (Tomorrow) for iPhone and iPad review: Productive procrastinating, at last!

Reader comments

How to force empty Trash on your Mac using Terminal

28 Comments

I've been using Macs for 7+ years now. Although I consider myself tech savvy, I never knew about this tip and certainly never needed it.

The tip provided is simply a workaround (which tend to be more complex, by nature) for a feature which RARELY hangs up. I've experienced this hang up once, and it didn't freeze, when I emptied my trash can; the hang up was likely caused by me attempting to "Secure Empty" the Trash with over 40 gigs of information in it.

You probably don't empty your trash much then. As a compulsive trash emptier I can attest to this happening at least once every week or so. A reboot of the computer also gets rid of the problem so if you turn your computer off at night (not a good practice actually), you will almost never experience this problem.

Does this work to "Secure Empty" as well, or is there another command for that? Or is there an option, at all, through Terminal.

This is not equivalent to using the "Secure Empty" function. For that I believe you would want to run "sudo srm -rf ~/.Trash/*" (note that you're running "srm" rather than "rm").

Imore: the #1 site for iPhone, iPod, iPad and AppleTV !!!!!!!

Why are we talking about Mac here ?????????????????

It was mentioned on Twitter a while back that Mac was now included in iMore's coverage. As a new Mac user, I'm very happy about this change. iMore is now my goto site for all things Apple, and tends to be much more accurate than other 'Rumours' sites.

While the command is valid, I personally would shy away from having less experienced users run commands like this. You are having them run a "root" command with rm -rf. This can be a *very* dangerous combination. For instance, changing the period to a space, in the command, could be catastrophic.

It also wouldn't hurt to throw in a little explanation of what the command is doing. Sudo - giving you root/superuser capability. rm -rf - removing files recursively & forced (i.e. no prompts).

I'd put a disclaimer up, myself.

For me, I find it generally quicker and easier to simply trash whatever process or program it is that is screwing up the trash because in fact, if your trash won't empty this is the cause pretty much every time. The system thinks "X.App" is still using the file that you've put in the trash even though it generally isn't.

If you force empty the trash using the method described here, you *may* lose data, but doing it by stopping the process or program that's causing the problem you will not.

PS - "Secure empty trash" is something that almost no one but a scientist or a CIA spy should use. It causes almost as many problems as encrypting your disk does and neither is generally necessary unless you are engaged in criminal activity.

The tip works great but a directory from the google account is stopping the delete process. States a code 50. Is there a command line to change the attributes from the folder in trash to one the IMac understands to delete?

ThankYou!!! I've been going crazy trying everything to force empty my trash. It just kept building up until finally there was 16,000 items! This was the only solution that worked for me! Much appreciated!!!!

Hi!
I've been having that problem forever, and now I have 40,000 items to delete!
I used you command and this is what I got in return:

"sudo rm -rf ~/.Trash/*"
-bash: sudo rm -rf ~/.Trash/*: No such file or directory
my name-ibook-g4:~ my name$
Any ideas?
Thanks!

Never mind! It worked! I think my mistake was to write the "", when I wrote it without "" worked.
YAAAYY!!! 90 fresh GBs in my computer!!!!!! Thank you!

Great I've been searching for over month to get this fix but with your info its fixed in seconds!!!! Thank You!

I have a good one, there is a temporary file (QuickTime) created in a folder from a software I used to have, I deleted the software and "delete" the folder containing the temp file.
I have tried anything from trash it to the sudo re - ir and also - rf inside the account, created a different account as administrator and tried from there, and I have no luck, once it tries to delete the temp file the orbe comes and stays there forever, in seconds the whole computer freezes and the only way to come back is by forcing it to turn off, the file is 1.5gb so you see my urgency to delete the darn temp file, in my pc I can delete the file so easy but in my Mac this turn out a nightmare.
anyone with another idea?

How can a non-admin user delete there trash using this feature? I get an response in terminal saying not a suds account and this incident will be reported.

Empty the Trash; I got the error message with a lot of files in and a lot more waiting. I am so thankful for your help. Such a relief.

OMG… :) it's been so long i google about this issue and finally found this & most importantly it wasn't difficult to understand at all… pretty straight forward coz the other solution i found i didn't understand at all what they asked me to do.. i really wanted to go to service center and ask them to fix it for me. LOL thanks so much for sharing. you have made my day…hehehe