iMyMac / Mac Cleaner / How to Empty Trash on Mac by Terminal.

How to Empty Trash on Mac by Terminal.

By Wian LJ | Lasted Updated 2018-10-12 01:45:19

Are you trying to empty the trash on Mac but to no avail? Learn how to empty trash via terminal and other effective methods in this new article.

Sometimes there are files inside the Trash folder that cannot be removed no matter how you try. There are several reasons why this is happening. It can be that the files are damaged, locked and more.

Today we will learn how to empty the trash using the various effective methods.

Part 1. Reasons Trash Cannot be Emptied

The trash bin is often referred to as the easiest folder to manage on Mac, you simply need to drag and drop the files to clean up. If you think Trash is the easiest file in your Mac, think again, there are many possible reasons why sometimes you will experience issues with the trash bin.

Here are some possible reasons:

  • Some files are in use even if they are really not
  • Some files need to be repaired
  • A special character in the file name can let your Mac think it's important and avoids deleting it

Whatever reasons your Mac is hiding from you, for sure, there is a way you can force the trash and empty it for good. Today, we will find out how to erase the files inside the trash bin and empty it for good.

Empty Trash Bin Mac

Part 2. How to Empty Trash via Terminal

Are you often receiving an error message that says: “This operation cannot be completed because the item [file name] is in use.”?

This error usually appears even if you don’t have any open files and the best thing you can do is to restart your Mac. The after restarting, you can empty the trash folder via terminal, or follow the steps below.

After restarting Mac, launch the Terminal via spotlight and follow these:

  1. Enter sudo rm –R (Do not hit enter and make sure you copy it correctly with the correct spaces)
  2. Press Control + click on the Trash icon to open
  3. Select all the files inside the Trash
  4. Drag all the files into the terminal window
  5. Press Enter
  6. If required, enter the Administration password
  7. Again hit Enter

That’s it! You have just emptied the Trash folder in your Mac. In case the steps didn’t work, make sure that the command you entered is correct.

Empty Trash By Terminal on Mac

Part 3. Clear the Trash via Safe Mode

If the first option was unsuccessful then try doing this next part to empty the trash folder via Safe Mode.

  • Reboot Mac in Recovery mode
  • Press Command + R keys when the device is rebooting
  • Click Terminal from macOS Utilities window
  • Enter the command: csrutil disable; reboot into the Terminal
  • Hit Enter. Note: You will see a message saying that System Integrity Protection has been disabled and your Mac needs to restart
  • Let the Mac reboot itself

Since Mac 10.11, System Integrity Protection or SIP, or also known as the rootless feature, was applied to prevent malicious software from changing protected files in Mac. You need to disable the SIP temporarily in order to remove files protected by SIP. You can turn it off in OS X El Capitan or the later versions using the steps above.

Pretty simple isn’t it? Now you can do this anytime your Mac won’t allow you to empty the trash folder.

Part 4. Use Mac Cleaner by iMyMac for Complete Solution

When all these above steps fail and your Mac sill will not allow you to empty your trash folder, it may mean that some apps or services are restricting you to do so. To better understand what is happening and to best empty, the trash folder or other system junks, use Mac Cleaner by iMyMac. This is all-in-one solution software that erases all unnecessary files, clutters, and even large and old files.

Here are the steps to use Mac Cleaner:

  1. Download and install software
  2. Launch Mac Cleaner and click Junk Files on the left pane
  3. Click Scan to begin
  4. Choose all the junk files in the display or you can rather erase those trash files only
  5. Click on clean and confirm the request
  6. Trash is finally empty!

You can take advantage of the Mac Cleaner’s efficient cleaning and scanning. Using this program you can track down the status of your Mac to see what affects its performance.

Clean Trash Bin on Mac

Part 5. What To Do When You Cannot Empty Trash for Other Reasons

There are some situations where the files are locked or destroyed which can hinder you from deleting all files inside the Trash folder. These files will only clog up later on so it is better to remove them as early as possible.

If you notice that the files are locked, you do the following:

  1. Make sure the file or folder is not stuck up. You can right-click on the folder and click Get Info.
  2. See if the locked option is checked; remove the check to empty the Trash.

Another option is to repair the Disk using the Disk Utility. You can use this option if the file is destroyed. You need to do the following to permanently delete from the Trash:

  1. Start Mac in Recovery mode
  2. Press and hold down Command + R keys when it is rebooting
  3. Release the keys when the Apple logo with the progress bar appears
  4. Choose Disk Utility and click Continue
  5. Select the disk that has the entire files you need to delete.
  6. Click on First Aid to repair the disk

Part 6. Summary

We have just provided several options to an empty trash folder. In case you are caught up with any of the given situations above, you now understand what to do. It is always better to regularly clean up your Trash folder because it affects the entire performance of Mac.

If possible, you can choose to install Mac Cleaner by iMyMac, this is an all-in-one solution that can clean, fix and scan your Mac at any time.

Have you tried any of the steps we recommended above? Share us your thoughts in the comments below!

iMyMac Software
Free Download and Try iMyMac
The most powerful and useful 7-in-1 Mac Software in 2018

The Useful Tips & Trick

Clean Mac
Clean Browser
Mac Uninstall
Download to try Mac Cleaner!
back to top
success

Subscription is successful !

error

Subscription failed !