0

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:

  1. Everything here
  2. sudo rm file.txt
  3. chflags -R nouchg file.txt
  4. 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 sappnd:

$ 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.

  • Do you know what the file is? (As in, did you make it, or did something in the system put it there?) – user24601 Jun 30 '15 at 23:47
  • @user24601 It's empty - created using touch file.txt – ughhh Jul 1 '15 at 0:15
  • 1
    You asked "...remove all the flags at once..." and from OS X Man Pages for CHFLAGS(1) it shows the "SYNOPSIS" as, chflags [-fhv] [-R [-H | -L | -P]] flags file ... and further down the page is says "The flags are specified as an octal number or a comma separated list of keywords.". So you could have used ls -lO to see what flags were set and if it was set as e.g., uchg,sappnd,schg then used the command as sudo chflags nouchg,nosappnd,noschg file.txt to unset all at one time. – user3439894 Jul 1 '15 at 2:34

You must log in to answer this question.

Browse other questions tagged .