Skip to main content

How to force empty Trash on your Mac using Terminal

How do you empty the trash on your Mac even when it tells you you can't? There's a Terminal trick for that!

Updated February 2017 with new information about the Terminal command for macOS Sierra.

There are a number of different reasons why your attempt to empty your Mac's trash bin might be thwarted. Maybe an item is "still in use" even though you know it's not. Maybe an item is locked. Maybe an item has a special character that makes your Mac think it's too important to just delete. Whatever the reason, fear not. There is a way you can force your trash bin to empty for good and it can be done using Terminal.

It used to be that you could force the trash to empty on your Mac using sudo rm -rf ~/.Trash/*, but it doesn't work in El Capitan or Sierra. If you are running OS X 10.10 or higher, follow these steps instead.

Note: There are keyboard shortcuts you can use force your Mac to empty the trash that you should try first. You can Control-click on an item in the trash and select Delete Immediately, or you can try holding down the Option key while emptying the trash. This Terminal trick should only be used if the other methods don't work.

How to force the trash to empty on a Mac using Terminal

  1. Use Spotlight to find and launch Terminal on your Mac.

  1. Enter the following command into terminal without hitting Enter afterward.sudo rm -RPlease note that there is a space after R. Make sure you add a space after R or this command will not work.
  2. Control-click on your Trash icon to open it.
  3. Select all of the files in your trash folder.
  4. Drag the files into the Terminal window.

  1. Hit Enter.
  2. Enter your administrator password. You will not see the password being typed into Terminal. It will look like nothing has changed.
  3. Hit Enter again.

Terminal with Empty Trash code

This may take a while to complete if you have a lot of large files in your trash bin.

If this command didn't work, it might be because you forgot to add a space after the R. Try the process again with a space.

Any questions?

Do you have any questions about using Terminal to force the trash bin on your Mac to empty?

Lory is a renaissance woman, writing news, reviews, and how-to guides for iMore. She also fancies herself a bit of a rock star in her town and spends too much time reading comic books.  If she's not typing away at her keyboard, you can probably find her at Disneyland or watching Star Wars (or both).

39 Comments
  • Thanks for the tip Allyson.
  • I thought mac was simple and just worked. That doesn't sound very simple to me.
  • 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.
  • It is simple, terminal is more geared towards developers or those whom want to have more control over their Mac and are competent enough to use it..
  • 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 ?????????????????
  • Because the 'More' in iMore includes Mac. :)
  • 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!
  • Thanks! Great tip! :D
  • 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.
  • When I do the sudo thing to empty the trash and press enter for password, it doesn't allow me type the pass words, not sure.
  • 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.
  • Worked perfectly! Thanks so much.
  • Thank you Allyson, great tip!
  • Very helpful tips Thanks Allyson!
  • Hmmmm.... didn't work for me. Here's a video. what am i doing wrong? http://www.screencast.com/t/kXEQYguR
  • 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
  • good job mate. i have few files which i was not able to delete by trash and this saved my day.
  • Doesn't work at all. bash: /usr/bin/sudo: Argument list too long This is a real nightmare. 0kb free on disk, already deleted 100s of large files and still no more free.
  • What do I do if I have no user password on my MAC?
  • Thanks for the tip. Works like a charm and saved me oodles of time.
  • how to delete trash and junk folders on android phone. Posted via the iMore App for Android
  • on android phone...how to delete all trash and junk folders. Posted via the iMore App for Android
  • I tried this, however, I am trying to empty the trash on a Toshiba 500 GB external drive. I have dragged a huge amount of files to the computer trash can from this External HD. While the trash can is Empty on my internal hard drive, when i plug in my External, the trash can then becomes full of that which I dragged the External. When i use Terminal I don't have the language i need to direct the Empty function to the External. How to I find the path syntax?
  • I have a question after reading how much you have helped others with their iMac issues, specifically Allyson. I tried your solution for emptying the trash and it began to work so fast that I freaked out. I had 2 million files and the majority of them were from a time machine. I dumped all the old folders into the trash not understanding that it could actually clog like a drain. Anyway the drain was loosening until it reached the backup folders and it slowed down. I stopped it by quitting the terminal. When I tried to start the process you described again, I got this message instead of a request for the password...iMac:~ User$....I don't read code so any suggestions?
  • 1. The screenshot shows how to "undelete" a file. It will be moved back.
    If you simply put files in the Trash you can restore them by opening the Trash (left-click on the Trash icon) and drag the files from the Trash to your Desktop or other desired location.
    2. "Time machine" is a built-in backup tool that works with your Mac and an external drive, As the problem you described, I read it. The files deleted in Trash bin could be a different problem which Time machine can't solve. you can read this article and learn more. I hope it will help.
    3. If you don't have a Time Machine backup yet, then your best option would probably be uFlysoft Data Recovery for mac software
  • 1. Turning off secure delete (which I believe is removed now) helped a lot for me. 2. Right-click and Delete Immediately often works too. 3. A reboot can help to. I have to say, for an OS that is supposed to "just work," this is a needlessly tedious process.
  • To be fair in the few years I've used a Mac I've never had any issues clearing the trash the normal way.