Skip to content

Instantly share code, notes, and snippets.

@jymmm
Forked from kennwhite/reset_osx_attributes.sh
Created December 21, 2017 02:47
Show Gist options
  • Save jymmm/c65cb87b0ad08056730692d5d31166ac to your computer and use it in GitHub Desktop.
Save jymmm/c65cb87b0ad08056730692d5d31166ac to your computer and use it in GitHub Desktop.
Remove all extended attributes recursively on an OSX directory & files and fix "chown: ... Operation not permitted" and "chmod: ... Operation not permitted"
# This is the nuclear option. Use with extreme care
# Works up to and including Mountain Lion (10.8.x)
# Show all extended attributes
ls -lOe ~/dir-to-fix
# Remove no-change attributes
sudo chflags nouchg ~/dir-to-fix
# Recursively clear all entended attributes
sudo xattr -rc ~/dir-to-fix
# The reset to rational owner & perms
sudo chown -R username:staff ~/dir-to-fix
sudo chmod -R 0700 ~/dir-to-fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment