Ever attempt to delete the Trash on OSX and run into an error that says you can’t complete the operation because you don’t have permissions to access some of the items? I am not sure how often this will happen to the average user that wouldn’t already know how to resolve the problem since the chances are high that the file or files created with different permissions required you to change to the root user in the first place. Anyhow below is a better description of the issue along with a screenshot followed by how to resolve the problem emptying your Trash on your Mac.
Emptying Trash On OSX: Cannot Complete Because Of Permission Error
The above error was received on a Macbook Pro running OSX Mountain Lion. I believe I must have created a test directory while I was logged in as the root user on OSX and moved it to the trash. When I finally decided to empty the Trash I was logged in as my normal user which is alex. Luckily resolving the issue is easy if you know your way around the Terminal a bit. Use the below example output/commands to remove the item in question and then you should be able to empty the Trash on OSX with the normal user.
Open a Terminal window on OSX and walk through the commands below. Once you are in the .Trash folder you need to list the file contents but make sure to use “sudo” as shown below before the “ls” command so you can see all contents of the .Trash folder.
Resolve OSX Trash Empty Permission Error:
- Alexs-MacBook-Pro:~ alex$ cd .Trash/
- Alexs-MacBook-Pro:.Trash alex$ pwd
- Alexs-MacBook-Pro:.Trash alex$ sudo ls -alh
- total 16
- drwx------ 3 alex staff 102B Nov 15 20:39 .
- drwxr-xr-x 57 alex staff 1.9K Nov 15 09:27 ..
- -rw-r--r--@ 1 alex staff 6.0K Nov 15 20:37 .DS_Store
- -rwx------ 3 root staff 102B Nov 15 20:39 test
- Alexs-MacBook-Pro:.Trash alex$ sudo rm -rf test
- Alexs-MacBook-Pro:.Trash alex$
The first command issued above puts us into the .Trash folder for your user. Once located inside of the Trash folder you should list the contents of the folder using “sudo ls -alh” which will list files owned by all users and if you happen to see a file owned by someone other than yourself such as the test file listed above that is likely the culprit of your problem. Please make sure to be careful with the “rm” command as if this command is not used properly you could permanently delete a file that will cause issues on your computer. If the file you are removing is in the .Trash folder then you should be fine since once in this folder it is not being used by any running programs or the operating system itself. Anyhow once you located the file simply issue the “rm -rf FILENAME” command to remove the file followed by attempting to empty the Trash to see if that resolve the problem.
If that did not resolve the problem then look for other files that are not owned by you or that have weird permissions and remove those one at a time until your issue is resolved.