6

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?

0

3 Answers 3

2

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.

0
1

I know this post is a few years old, however, it just happened to me in Catalina and @Matty's response led me to investigate into preferences.

To solve this problem, you have to go to System Preferences/Security&Privacy/Privacy. Then from the left-hand side column, you have to choose Files and Folders, then in the right side window, you will see which folders or files Terminal was trying to access and whether access was granted by check marks next to the File/Folder.

The File/Folder with no checkmark should be the one that you are receiving the Permission Denied. To restore permissions, click the box next to the File/Folder in question.

Something to note in Catalina, apps that require access to your disk require your permission to access Files/Folders. So in the case of Terminal, if you are moving around directories a lot, you will be presented with dialog popups requesting you to give the app permission to access the contents. To save yourself this hassle, you can give the app access to the full disk, or you can limit its disk access. You have the power.

0

I am not in front of my Mac but I believe in either Disk Utility or the info of the direcory there is a item call fix disk permissions, you may be about to call it and that should solve your issue as well.

As a side note if you get permissions denied error try running it with sudo as long as you are sure you know what you are doing. The sudo password is just your login password.

1
  • 1
    I think the problem was that the OP couldn't even open any application (like they said, they would constantly bounce), and sudo lives in /usr/bin, so they couldn't even use sudo because it doesn't have read access anymore.
    – slhck
    Commented May 4, 2013 at 6:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .