1

I found a directory on my machine called "Previous System" that looked old and useless and I tried to delete by dragging to the trash and emptying the trash. That failed to delete the directory, because emptying the trash gave me messages such as The file 'Applications' is in use. or The file '.MobileBackups' is in use.

So I dragged that directory out of the trash and went into the terminal to delete it, but it seems undeletable. For example:

$ cd ~/Desktop
$ sudo mv Previous\ System prevsys
$ sudo rm -rf prevsys
rm: prevsys/.MobileBackups/Computer/2014-10-20-143930/Volume/Applications/CrashPlan.app: Operation not permitted
rm: prevsys/.MobileBackups/Computer/2014-10-20-143930/Volume/Applications: Directory not empty
rm: prevsys/.MobileBackups/Computer/2014-10-20-143930/Volume: Directory not empty 
rm: prevsys/.MobileBackups/Computer/2014-10-20-143930: Directory not empty
rm: prevsys/.MobileBackups/Computer: Directory not empty
rm: prevsys/.MobileBackups: Directory not empty
rm: prevsys: Directory not empty
$ cd prevsys
$ sudo ls -l
total 0
drwxr-xr-x+ 3 root  wheel  102 Nov 18  2013 .MobileBackups
$ sudo cd .MobileBackups
$ pwd
/Users/blah/Desktop/prevsys

I've never seen a directory that I can't cd into as the superuser, so I'm not really sure, how do I get rid of this thing? Thanks.

Kevin Panko
  • 7,466
jay
  • 143

1 Answers1

2
$ sudo -i
$ cd prevsys/.MobileBackups/Computer/2014-10-20-143930/Volume/Applications
$ chflags noschg CrashPlan.app
$ chflags nouchg CrashPlan.app
$ cd ~/Desktop
$ rm -rf prevsys

The problem was that the CrashPlan.app directory, with CrashPlan running or not, had a "system immutable" flag (schg) and a "user immutable" flag (uchg) attached to it. The two chflags commands turn off those flags (by appending "no" to the name of the flag), then once those are turned off, the whole stupid directory could be removed.

Thanks.

jay
  • 143