Deleting files in Mac Trash without permissions

I’ve had a situation where large files are in my Mac’s Trash folder, but I cannot delete it because I do not have sufficient permissions. I tried to create a new folder on my desktop and move the files there but I couldn’t do that either. I searched and finally found this snippet from Apple’s Support site.


Emptying the Trash

In some circumstances, folders for which you do not have write permission can end up in the Trash; and you will not be able to delete them or the files contained in them. Remember that in Mac OS X there is not a single Trash folder. Instead, each user has a Trash folder in their home directory (named “.Trash”). There is also a Trash folder for the startup volume, and Trash folders for other volumes or disks. When a user throws away a file on a local non-startup volume, the name of the folder on that volume is “/.Trashes/UID”, where UID is the user ID number of the user (which may be seen in NetInfo Manager). In either case, all Trash folders are hidden from the user in the Finder. In these situations you can either start up into Mac OS 9 to locate the files and delete them, or you can use the Terminal application. Issues with emptying the Trash are much less likely to occur in Mac OS X 10.2 or later, since the Finder empties the Trash as the root user. However, issues may still occur with files on remote volumes for which your local root user has no special privileges.

Warning: Typographical error or misuse of the “rm -rf” command can result in data loss. Insertion of a space in the wrong place could result in the complete deletion of data on your hard disk, for example. You may wish to copy and paste the commands below into a text editor to verify spacing. Follow these steps to delete Trash for the logged-in user:

1. Open the Terminal application.
2. Type: sudo rm -rf
Note: Type a space after “-rf”. The command does not work without the space. Do not press Return until Step 6.
3. Open your Trash.
4. Choose Select All from the Edit menu.
5. Drag all of your Trash into the Terminal window. This causes the Terminal window to automatically fill in the name and location of each item in your Trash.
6. Press Return.

All of the items in your Trash are deleted. As an alternative method, you may execute these commands. The second and third commands will delete Trash belonging to other users. The commands are:

Warning: Typographical error or misuse of the “rm -rf” command can result in data loss. Insertion of a space in the wrong place could result in the complete deletion of data on your hard disk, for example. You may wish to copy and paste the commands below into a text editor to verify spacing.

Important: There is no space between “/” and “.Trash” or “.Trashes” below.

sudo rm -rf ~/.Trash/
sudo rm -rf /.Trashes/
sudo rm -rf /Volumes//.Trashes/

Note: To end the sudo session, you should either execute the exit command, or log out of Mac OS X and then log back in.

Respectively, this permanently deletes all files in the current user’s Trash, the startup volume Trash, and the Trash for other volumes (if any). These commands cannot delete locked files. You have to unlock them first.

Note: The sudo command can be used to temporarily obtain super user status and change permissions on files that otherwise could not be changed. However, it is only available if you are logged in with an administrator account, and it requires an administrator account user password for authentication.

Leave a Reply