In the course of a typical workday, I tend to amass temporary files on my desktop. These may be placeholder images or snippets of code I wrote for later or "borrowed" from Stack Overflow...
Every few hours I will catch a glimpse of this chaos on my desktop and my need to see a clean desktop will compel me to clean it up. Seems simple enough, Trash the files I don't need, and get back to coding.
Except when it isn't so simple, and my system's Trash has become corrupt, showing the message in the image you see above.
This is how to fix this issue whenever it arises:
Enter the following commands into Terminal, one line at a time. (The first line will prompt for your password.)
sudo rm -rf ~/.Trash sudo rm -rf /Volumes/*/.Trashes mkdir ~/.Trash sudo chown $UID ~/.Trash chmod u+rwx ~/.Trash
When you have finished entering these commands, quit Terminal. Your Trash should now be fixed. Move a file to Trash to make sure it now works properly. Then empty Trash to make sure that works too.
Pro Tip: Create an alias to make your life easier! (Apple engineers can't seem to fix this issue and if your system is affected by this it will happen repeatedly).
If you don't know how to create a Bash Shell alias, this article explains it.
Here is the alias I use on my MacBook Pro:
alias fixTrash='sudo rm -rf ~/.Trash && sudo rm -rf /Volumes/*/.Trashes && mkdir ~/.Trash && sudo chown $UID ~/.Trash && chmod u+rwx ~/.Trash && echo "Trash has been reset."'
Depending on your Mac's permissions, you may have to temporarily disable System Integrity Protection (SIP) for this, here are the steps to do that if necessary:
Turn off your Mac.
Press Power button, then quickly hold down command + R button together to boot into Recovery Mode.
Once your Mac has booted into Recovery Mode, choose Utilities from the menu bar and select Terminal and enter the following command:
This command will return a response of either "System Integrity Protection status: enabled." or "System Integrity Protection status: disabled."
If Enabled, type the following command into Terminal:
You should see a message stating "Successfully disabled System Integrity Protection."
Close Terminal and restart your Mac.
To re-enable SIP, go back into Recovery Mode as you did before and type the following command into Terminal:
You should see a message stating "Successfully enabled System Integrity Protection."
Restart your Mac.
If issue persists, you may need to re-build your user account:
- Log into another admin user. (Create one if no other admin user exists.)
- Delete your main user from System Preferences > Users and Groups.
- Be sure to select the option to “Keep a copy of the home folder”.
- Open Finder > Go > Computer > Macintosh > Users > Deleted Users, and remove “Deleted” from the username, then move back into Users folder.
- Re-create the user in Users and Groups, making sure to use the same username (Home folder name), and password. (And choose administrator if it was one).
- Create the user & when prompted select the option to “Use the existing folder”.
- Restart and login to your original user.
Top comments (3)
this was helpful to me, I had a problem with the trash looks like a problem with permissions but I had to deactivate system integrity protection, thanks a lot
Thanks, it is working perfectly.
Thank you very much!