6

I've got a pretty scary problem. Yesterday I wanted to empty the trash but somewhere in the process it just hung up. I rebooted a few times and tried it again and again but with no result.

I then used the terminal to delete the files out of the .Trash folder manually and I could narrow down the problem to one particular file/folder that I can't delete. If I try rm -rfv <file/foldername> it just hangs up. Even if I try to get more infos about the file/folder with ls -l it will hang up.

I also tried to repair the volume using disk utility with no success.

1
  • Try the "secure delete" option from the Finder menu. It'll delete even files that are in use, without the need for terminal commands.
    – user10355
    Commented Oct 29, 2011 at 9:59

2 Answers 2

8

Tricky indeed, things to try

  • steps recommended by Apple (HT1526 via archive.org) but it seems you did most of them already
  • remove and recreate the whole trash folder: cd ~; rm -rf .Trash; mkdir .Trash; chmod 700 .Trash
  • delete by inode: cd .Trash; ls -i should give you the inode number; find . -inum INODE -exec rm {} \; deletes by inode number
  • (if you are an admin user) run the commands above with sudo rm
  • boot into Single User or Recovery Mode (HT201255) and run fsck/volume repair
2
  • rmi.c does the same as unlink or rm -i, only that on a modern macOS you won't be able to compile it anymore. The updated and working link to booting into recovery or single user mode is HT201255. HT1526 redirects onto HT201583 on the way back machine, but also this link is not available anymore. For the second point you might want to perform the part of removing using sudo. If you have a restricted file (check using ls -al0), your only option to delete it is most likely single user mode. Do you feel like updating your entry?
    – ikaerom
    Commented Jan 7, 2022 at 9:07
  • @Moreaki Thanks for pointing out the broken links etc.
    – nohillside
    Commented Jan 7, 2022 at 10:35
2

I come from a similar problem and it might be related to "Ways to Delete Files that Cannot be Deleted on Mac".

Here is another solution. In my case, I couldn't remove the Mojave installer. Here are the steps that I took:

  1. Move non-removable files or folders to Trash. Shut down the macOS.
  2. Run macOS in Recovery mode, press Cmd+R while starting up the machine.

Photo of the Recovery Menu

  1. Open Disk Utility, select Macintosh HD > Macintosh HD - Data and tap Mount

Photo of Disk Utility with the 'Macintosh HD - Data' partition selected

Photo of Disk Utility with the 'Mount' option selected

  1. Close Disk utility. From the top menu select Terminal
  2. Go to /Volumes/Macintosh HD - data/Users/{your login}/.Trash/

Photo of Terminal with the contents of /Volumes/

Photo of Terminal showing the contents of /Volumes/Macintosh HD - data/Users/

Photo of Terminal showing the contents of /Volumes/Macintosh HD - data/Users/micahal/.Trash/

  1. Call rm -fr {your_file_or_folder}
  2. Close Terminal and restart macOS.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .