Internet Bandaid   [RSS Feed]

Archive for the ‘permission’ tag

Can’t delete time machine – operation not permitted

without comments

I recently had a lot of trouble deleting time machine files off of an external HD that once ran the mac osx software.   Everytime I tried to delete something, I got operation not permitted error, even when I ran as sudo commands or logged in as su.

Someone wrote a solution to the problem, which I repost here:

4 – The Nightmare Scenario

If all of the above methods fail, the offending files my have the System Immutable flag set. Such files are locked Fort Knox style. The System Immutable flag cannot be changed by root. Only by super-root – the super-duper-user. What!?!

When your Mac is up and running in multi-user mode (the normal operating mode) it is running at level 1. Some operations even root can’t do at level 1, such as turn off the System Immutable flag. You must run at level 0. Switching into single user mode will allow one to run at level 0 and thus change the System Immutable flag.

Do this.

Close all applications and issue the command:

% sudo shutdown +0 "Bye bye"

to shutdown multi-user mode and enter single user mode. You will lose all services such as network connectivity while in single user mode. Alternatively, you can reboot your Mac, then startup with both the Command (Apple) key and the ‘s’ key held down.

% cd /Users/your-name-here/.Trash
% chflags -R noschg *

Then hit control-d to return to multi-user mode. You should now be able to delete the trash with the Finder, or by reapplying the steps above.

Note: when you enter single user mode, type:

% whoami

if the answer is not root type:

% su

and type control-d twice when you exit.

Other Trashes

On some occasions, trash is placed at the root level of your system disc or another partition or drive. The directory is:




See if they are empty by listing them.

% sudo ls -al /.Trashes/501

’501′ is the User ID of the user who did the trashing.

% sudo ls -al /.Trashes

may reveal several such 50x directories.

You can check your own User ID (uid) by issuing the command:

% id

and substitute this if it is not 501.

You can then apply all the techniques given for ~/.Trash to /.Trashes/501.

And Finally

If you still have problems, and you have re-applied the above steps as necessary, you probably have a corrupt file system.

Firstly, enter single user mode and issue:

% fsck

and answer the prompts, or else have ‘fsck’ run automatically with:

% fsck -y

You can also try commercial disc repair programs.

Happy trashing, and

Enjoy :-)

Written by John Lai

December 28th, 2010 at 7:08 pm