Can't put anything in the trash & terminal tweak not working

Hoping one of you brilliant folks can help me out. I’m unable to put anything in the trash can but instead get an alert that I can delete it immediately. I had this issue probably about once a month in Mojave, but I found this terminal command online that fixed my issue:

sudo rm -rf ~/.Trash
sudo rm -rf /Volumes/*/.Trashes
mkdir ~/.Trash
sudo chown $UID ~/.Trash
chmod u+rwx ~/.Trash

Unfortunately, in Catalina that command produces the error “Operation not permitted.” I heard Catalina changed terminal command somehow, but I’m not enough of a terminal genius to know how to tweak it to make it work. Help? Either with the regular issue of not being able to put things in trash OR on tweaking that terminal command so I can run it in Catalina?

This is very unusual. The trash system is something that usually just works.

Googling around, it seems people have had issues with third-party software that allows using other file systems like NTFS. Have you ever installed anything like that?

Does Terminal have full disk access in System Preferences?

1 Like

Never tried the tweak you show but I get the error message about deleting things immediately only when I try to drag or delete something off my Synology server into the trash. So I’d look at the source of the stuff you are deleting and make sure it’s really the system disk.

You posted 5 commands. Which one gave the error? That might help narrow it down.

I suspect @ismh might be on the right track with Full Disk Access for Terminal.

Having this problem repeatedly is extremely unusual. Next time it happens, you should really try to figure out what’s going on rather than using those 5 commands, which is basically the terminal version of a bazooka.

@tjluoma is right, you need to figure out why this is happening. Next time, please post the output of these terminal commands:

ls -ld ~/.Trash
ls -l ~/.Trash
ls -ld /Volumes/*/.Trashes
ls -l /Volumes/*/.Trashes

If any fail, try it with sudo.

Thanks – it happened infrequently enough and the solution worked each time that I didn’t go to the effort of diving into why it was happening. But I definitely need to now.

I gave Terminal full disk access–that solved part of the problem–and repeated my previous commands which seem to have the trash can working again. But I’d like to solve this problem long term.

I entered the commands you suggested. Here’s the output:

Couple comments: 1) the “staff” was my old workplace user account–I actually should go to delete that.

  1. The problem is probably that trashes permission are denied–how on earth would I go about fixing that?

Bingo, that was the issue with my terminal commands! Thanks. When I ran all the commands, the trash started working again, but I got this odd error. Do you know how to fix it?

Not to my knowledge :confused:. And I started this as a brand new machine 1 year ago–nuked and paved from my old one–so I think I would remember. Thanks for the idea though.

Yeah, oddly enough I can use trash from an external drive, but not from my internal drive. Very odd.

OK, thank you very much–both for the advice and for helping me realize I need to look into the cause of the error and not just bazooka it every time :grinning:. @ismh was correct that the Terminal error was due to Full Disk Access – I was able to run the commands as normal, and trash starting working again, but I got this error:

Followed @jec0047’s advice and ran his code, got these results:

Any idea how to fix those issues and/or advice in figuring out why this is happening so I don’t just keep bazooka-ing it?

A million thanks!

I can explain almost everything I’ve read in the last few posts.

Beginning with Catalina macOS was split into two filesystems: ‘Macintosh HD’, which is a read-only filesystem, and ‘Macintosh HD - Data’, which is a read/write filesystem.

Macintosh HD is mounted at / (the root of the filesystem). Macintosh HD - Data is mounted at /System/Volumes/Data. Therefore no user can write anything into /Volumes, thus the “Read-only file system” errors when trying to rm -rf /Volumes/*/.Trashes . This would have worked on Mojave but there is no point in trying this any longer.

“staff” is a group, of which you, “mm”, are a member. You don’t need to change anything here.

Putting a file from an external drive into the trash works differently than it does on your internal drive, because you can’t “move” a file between filesystems, instead you have to copy the file to the destination filesystem and then delete the file from the source filesystem. In fact, it appears that when you drag a file from an external drive into the trash it is simply deleted. Anyway, no need to change anything here.

So the only real mystery is what is happening to your own trash, ~/.Trash.

It appears you ran the “ls” commands I suggested after you ran the “rm” commands. Is that correct?

I don’t have Catalina installed, so I may be talking through my hat. Still…

  1. If you can’t drag files into the Trash in the Finder, the problem is almost certainly with ~/.Trash, not with anything in /Volumes/Macintosh HD/.Trashes.

  2. As @jec0047 said, you need to learn the permissions via ls -ld ~/.Trash before you delete and remake it. If you can’t drag files into the Trash, one reason may be that the permissions have been changed from drwx------ to something else—something without that w.

  3. If write permission to ~/.Trash has been removed—for whatever reason—all you need to do is restore write permissions to that directory with chmod u+w ~/.Trash. You don’t need to rm the directory and then mkdir it again. (You don’t show it, but I am assuming you did a mkdir ~/.Trash after those rm -rf commands.)

  4. Even if this is the case, it still leaves unanswered the question of why your Trash permissions are being screwed up. I have no idea.

  5. I’m guessing that some of the problems you’re running into with the last two of your five commands are due to Catalina changing to a read-only filesystem for running the OS itself: But again, that shouldn’t affect ~/.Trash, and I don’t think you need to be running the commands that involve /Volume/*/.Trashes.

Again, take all this with a big grain of salt.

1 Like

@drdrang, I believe you are absolutely correct.

My understanding is there is a .Trash folder on each external drive, so when files on an external drive are placed in the trash, they are simply moved to the .Trash folder on the drive. No need to copy, then delete.

You are correct @JohnAtl. When I tested this I didn’t look closely enough.

1 Like

Unfortunately, yes, I ran the ls commands after the rm commands. If it acts up again, I’ll definitely run ls first.

Thanks for the input–that makes sense. Looks like the mystery is just why this continually happens. Not terribly frequent, but probably once a month. I hoped Catalina would fix it, but no such luck.

Anything else you can recommend to track down the issue? I could reach out to support but there advice is almost always “reinstall macOS” and it’s not worth that aggravation to me–at least not yet

Thanks @drdrang, that is super helpful. In particular, running chmod u+w ~/.Trash instead of what I was doing is far simpler. Still doesn’t explain why ~/.Trash is losing permissions every now and then (maybe 1x/month), but an easier fix and should be one that works now in Catalina. If this pops up again, I’ll make sure to run ls -ld ~/.Trash and post results here. Hopefully we can track down the issue.

Not your fault, I should have been more clear. Next time it happens do this in Terminal:

ls -alR@ .Trash > trash.txt

This will generate a file named trash.txt in your home directory. You can open it with TextEdit. If it’s not very big go ahead and post it here, otherwise post the first 10 lines or so and we’ll go from there.

I think it would be better if you don’t fire the bazooka right away. Instead, create a folder on your desktop and put the stuff you can’t put in the trash in the new folder.

1 Like

Great, thanks for that help! I will try to deal with this first before bazooka-ing things :grinning:. Unfortunately, with my workflow, I actually delete a lot of files, but I could probably come up with a Keyboard Maestro script to move them to a temporary folder instead. Thanks!