Removing Time Machine backup directories and other stubborn files: Difference between revisions
Blinkenjim (talk | contribs) No edit summary |
Blinkenjim (talk | contribs) No edit summary |
||
Line 16: | Line 16: | ||
find . -type d -print0 | xargs -0 chmod +x | find . -type d -print0 | xargs -0 chmod +x | ||
</pre> | </pre> | ||
Remove any access control lists (ACLs): | Remove any access control lists (ACLs): | ||
Line 21: | Line 22: | ||
chmod -R -a# 0 . | chmod -R -a# 0 . | ||
</pre> | </pre> | ||
For some reason the above doesn’t remove ACLs on symbolic links; remove these ACLs: | For some reason the above doesn’t remove ACLs on symbolic links; remove these ACLs: | ||
Line 26: | Line 28: | ||
find . -type l -print0 | xargs -0 chmod -h -a# 0 | find . -type l -print0 | xargs -0 chmod -h -a# 0 | ||
</pre> | </pre> | ||
Now the subdirectories should be removable. | Now the subdirectories should be removable. | ||
Line 36: | Line 39: | ||
'''NB:''' The success of all this seems to depend on having the filesystem mounted with the noowners option (i.e. mount -o noowners…). This can be accomplished with mount(8) or by clicking the box at the very bottom of the volume's ‘Get Info’ box - though note that some volumes don’t offer this switch, even if they ''can'' be mounted noowners. | '''NB:''' The success of all this seems to depend on having the filesystem mounted with the noowners option (i.e. mount -o noowners…). This can be accomplished with mount(8) or by clicking the box at the very bottom of the volume's ‘Get Info’ box - though note that some volumes don’t offer this switch, even if they ''can'' be mounted noowners. | ||
Boot into recovery mode (⌘+R at boot). Use disk utility to ensure proper disk is mounted. | Boot into recovery mode (⌘+R at boot). Use disk utility to ensure proper disk is mounted. |
Revision as of 01:58, 13 June 2021
(Try in this order: chmod -R +nw . ; find . -type d -print0 | xargs -0 chmod +x ; find . -type l -print0 | xargs -0 chmod -N ; chmod -R -N . ; chflags -R nouchg .
; then remove all.)
Here’s the approximate incantation:
First, remove all user-immutable flags:
chflags -R nouchg .
Second, make everything readable and writeable:
chmod -R +rw .
Next, make sure all the directories are listable (using the execute bit):
find . -type d -print0 | xargs -0 chmod +x
Remove any access control lists (ACLs):
chmod -R -a# 0 .
For some reason the above doesn’t remove ACLs on symbolic links; remove these ACLs:
find . -type l -print0 | xargs -0 chmod -h -a# 0
Now the subdirectories should be removable.
Note: The chmod -a commands will report lots of files without ACLs; consider piping their output through a grep:
chmod -R -a# 0 . 2>&1 | grep -v ‘No ACL present’
NB: The success of all this seems to depend on having the filesystem mounted with the noowners option (i.e. mount -o noowners…). This can be accomplished with mount(8) or by clicking the box at the very bottom of the volume's ‘Get Info’ box - though note that some volumes don’t offer this switch, even if they can be mounted noowners.
Boot into recovery mode (⌘+R at boot). Use disk utility to ensure proper disk is mounted.
umount disk99 mkdir /Volumes/Name mount -o noowners /dev/disk99 /Volumes/Name