Macos – How to restore the permissions of the “/usr” folder

file-permissionsmacosterminal

I accidentally set the permission of my hidden 'usr' to 'no access' (meant read only). Now no applications can open (they just bounce).

When trying to sudo cd or ls in terminal, I simply get:

bash: /usr/local/rvm/scripts/initialize: Permission denied

and

Illegal instruction: 4

respectively. Argh catch 22!

Any ideas, people?

Best Answer

Do you have a backup?

If not, you should be able to fix the permissions by booting into Single User Mode. Hold CmdS while rebooting, and in the prompt, enter mount -uw /.

Then try running:

chmod u+r /usr

which should give the owner read permissions again. You can, of course, do that recursively by calling chmod -R u+r /usr, depending on what exactly you did to screw up your permissions.

If you also changed the owner, you can set it back to root:wheel for /usr and its subfolders, except for /usr/local, which should probably be username:admin (where username is your admin user's name).

Once you're done, type reboot.

Related Question