this post was submitted on 05 Apr 2025
7 points (100.0% liked)

macOS

1126 readers
1 users here now

The home for all things macOS on LW.

Rules:

founded 2 years ago
MODERATORS
7
Undeletable files (lemmy.world)
submitted 3 weeks ago* (last edited 3 weeks ago) by TomMasz@lemmy.world to c/macos@lemmy.world
 

I've got a couple of files (empty directories) in the Trash I can't delete. I own them, the mode is 777 and whether I use Empty Trash or use rm from the command line (with sudo or running as root) I get "Permission denied". I tried booting into recovery mode and setting csrutil to disabled but that did nothing. Any ideas? It's not the end of the world but every time I empty the trash I have to deal with the dialog box about not being able to delete them.

you are viewing a single comment's thread
view the rest of the comments
[–] nicerdicer 2 points 3 weeks ago* (last edited 3 weeks ago) (4 children)

There was a bug once that affected files which had been write-protected by user. Once a file had been made write-protected, it coudn't be either moved into trash, or be deleted at all - because, it was write-protected. Even fixing file permissions didn't help.

Could it be possible that you moved such a protected file into trash? Try the following command in Terminal:

sudo rm -rf ~/.Trash/* then enter your password. This should empty the trash by force.

Alternatively:

  1. Open Terminal and enter sudo rm followed by a space. Do not press the Enter key afterwards (this is important).
  2. Now open the recycle bin in the dock and drag the files in the recycle bin into the Terminal window.
  3. Press the Enter key and enter your password to confirm. Press the Enter key again.
    .
    Edit: After reading my comment once again: The second sentence should read:
    Once a file had been made write-protected, it coudn't be either moved into trash, or be deleted at all. Even, removing the write-protection by unchecking the tick box in the file information was not possible - because, it was write-protected.
[–] TomMasz@lemmy.world 1 points 3 weeks ago (3 children)
[–] nicerdicer 2 points 3 weeks ago (1 children)

I'm sorry to hear that. What about another attempt:

  • move the files from Trash onto your Desktop
  • mount a (otherwise empty) thumb drive or a hard disk
  • now move these files onto your thumb drive

Are you able to move the files from your Desktop onto the thumb drive? If not, I'm out of ideas. If yes:

  • open Disk Utility
  • delete (format) the thumb drive in order to get rid of the files.

Perhaps this works. Good luck.

[–] TomMasz@lemmy.world 2 points 3 weeks ago (1 children)

That didn't work either but the error message said something about needing it to be downloaded. That reminded me it was originally on OneDrive so I put it back when it started, went to the OneDrive site in a browser and was able to delete it from there. Thanks!

[–] nicerdicer 1 points 3 weeks ago

That's the nasty thing with OneDrive: Usually, your file that you have created is on your computer. So this is considered as "original". A copy of that file is then uploaded into the cloud.

With OneDrive it is reversed. The file you created on your computer probably is saved to OneDrive immediately, making this the original file. On your computer there is just a copy that acts as an alias.

If you have Microsoft Office as a stand-alone version (e.g. home or student version) installed on your computer, go settings and look where you can change that files are saved onto your computer in order to avoid this in the future (this might not be an option if you use Office 365, as they do not support to change the save location any longer, as far as i recall).

load more comments (1 replies)
load more comments (1 replies)