Question

I've installed homebrew, and am trying to change the write permissisons 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 on this directory. Some versions of the "InstantOn" component of Airfoil are known to do this.

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

I tried doing that with chown, but I'm pretty new at this and don't think I was running it correctly. I ran:

chown myusername /usr/local/include

I didn't get any error message, but when I run brew doctor it says I still lack permission to write to /usr/local/include.

Any help would be greatly appreciated!

Edit:

I'm getting an "operation not permitted" error.

cd /usr

chown myusername local

chown: local: Operation not permitted

Was it helpful?

Solution

On my system, /usr/local is owned by root:admin and is rwxrwxr-x. My user is a member of the admin group, thus has write permissions. I haven't messed with ownership and permissions there, and my Homebrew installation is not complaining, so I assume my setup fits its requirements.

Check the ownership of your /usr/local; if it is owned by group admin, check if your non-adminsitrator account is a member of that group.

OTHER TIPS

Simple solution that worked for me:

  1. click on your background to go to finder
  2. click on go and go to folder /usr
  3. right click on local and do get info
  4. unlock the lock at the bottom
  5. click + sign and add your user to the list and give read/write privileges
  6. click on the gear sign at the bottom and choose apply to enclosed items to recurse under that directory and assign privileges too all directories beneath it.

type brew doctor from command prompt to test. My result:

Your system is ready to brew.

You should use: sudo chown username folder

Be careful with the change of ownership

Do not try to change ownership for /usr/ or recursively for /usr/local/ if you are not getting the same error posted in the original question.
You could screw up your system or weakness its security.

Some users can receive with homebrew permission errors that could be solved without changing the ownership of the whole /usr/ or /usr/local/ directories.

According to my experience, in most cases, it is just enough to restore the ownership for /usr/local/Cellar:

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

Alternatively, if you have a not standard installation

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

You can try use command ls -l. With this command you will see list of files in current directory with some useful information, like who is owner of this file. So you will see if chown worked out. I believe that chown is a right command for changing ownership.

Exactly this problem has just started occuring on my MacBook.

The owner of /usr/local is:

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

I am unable to change the permissions and add myself via Finder - I get a "you don't have the necessary permission" error.

Is this maybe due to security changes in mac os? (I have 10.13.6)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top