Changing directory ownership in OS X

I installed homebrew and am trying to change write permissions for the / usr / local / include directory.

When I run 'brew doctor', I get this error message:

Error: The / usr / local directory is not writable. Even if this directory was writable when you installed Homebrew, other software may change permissions for that directory. Some versions of the “InstantOn” aerodynamic component are known to do this.

You should probably change the ownership and permissions of / usr / local to return to the user account.

I tried to do this with chown, but I'm pretty new to this and don't think I ran it correctly. I ran:

chown myusername /usr/local/include 

I did not receive an error message, but when I run brew doctor, it says that I still do not have write permissions in / usr / local / include.

Any help would be greatly appreciated!

Edit:

I get an error "operation not allowed".

cd /usr

chown myusername local

chown: local: operation not allowed

+8
source share
6 answers

On my system, /usr/local owned by root:admin and rwxrwxr-x . My user is a member of the admin group, so I have write permissions. I did not abuse property rights and permissions there, and my Homebrew installation does not complain, so I assume that my setup meets its requirements.

Check ownership of /usr/local ; if it belongs to the admin group, check if your non-adminsitrator account is a member of this group.

+8
source

A simple solution that worked for me:

  • Click on your background to go to the search.
  • click go and go to the / usr folder
  • right click on local and get information
  • unlock lock below
  • click + sign and add the user to the list and give read / write permissions.
  • click on the gear sign at the bottom and select the ones that apply to private items to recurse under this directory and assign privileges to all directories under it as well.

type brew doctor from the command line to check. My result:

Your system is ready for brew.

+20
source

You should use: sudo chown username folder

+2
source

Be careful with ownership changes

Do not try to change the owner for /usr/ or recursively for /usr/local/ if you did not get the same error in the original question.
You can ruin your system or weaken its security.

Some users may receive errors with permission from the homegrown business that can be fixed without changing the owner of the whole /usr/ or /usr/local/ directories.

According to my experience, in most cases, it is enough to simply restore ownership of /usr/local/Cellar :

 sudo chown -R "$USER" /usr/local/Cellar/ 

Alternatively, if you have a custom installation

 sudo chown -R "$USER" "$(brew --prefix)/Cellar" 
+1
source

You can try using the ls -l . With this command you will see a list of files in the current directory with useful information, for example, who owns this file. So you will see if chown worked out. I believe chown is the right command to change ownership.

0
source

This is the problem that just appeared on my MacBook.

Owner / usr / local:

 drwxr-xr-x 24 root wheel 768 Apr 9 17:25 local 

I can’t change the permissions and add myself through the Finder - the error “you do not have the necessary rights” appears.

Maybe this is due to security changes in Mac OS? (I have 10.13.6)

0
source

Source: https://habr.com/ru/post/917263/


All Articles