I have a locked file on my machine that I'm unable to delete. I've tried everything (that I know of) and don't have a clue why it won't delete.
Here's what I tried:
- Everything here
- sudo rm file.txt
- chflags -R nouchg file.txt
- unlocked the file in "get info"
None of which worked.
Here is the typical result I get (admin is "me"):
$ sudo chflags -R nouchg file.txt $ sudo rm file.txt override rw-r--r-- me/staff sappnd,schg for file.txt? y rm: file.txt: Operation not permitted
WTF is going on here???
UPDATE: tried this and still no joy:
$ sudo chflags noschg file.txt $ sudo rm file.txt override rw-r--r-- me/staff sappnd for file.txt? y rm: file.txt: Operation not permitted
UPDATE2: turns out there was another flag also
$ sudo chflags sappnd file.txt $ sudo rm file.txt
The flags on the file were the cause, so after removing them the file could be deleted. I'm not sure if there's a way to remove all the flags at once, but would have been easier.