Homebrew: Could not symlink, /usr/local/bin is not writable [closed]

The other answers are correct, as far as they go, but they don’t answer why this issue might be occurring, and how to address that root cause.

Cause

There are two possible causes to this issue:

  1. The homebrew installation was performed with a user other than the one you are currently using. Homebrew expects that only the user that installed it originally would ever want to use it.
  2. You installed some software that writes to /usr/local without using brew. This is the cause brew doctor suggests, if you run it.

Solution

Multiuser Homebrew

If you have multiple user accounts, and you want more than one of them to be able to use brew, you need to run through a few steps, otherwise you will constantly have to change ownership of the Homebrew file structure every time you switch users, and that’s not a great idea.

Detailed instructions can be found online, but the quick answer is this:

  1. Create a group named brew:
    1. Open System preferences
    2. Click Accounts
    3. Click the “+” (unlock first if necessary)
    4. Under New account select Group
    5. enter brew
    6. Click Create Group
  2. Select the brew group, and add the user accounts you want to use brew to it.
  3. change the /usr/local folder group ownership: sudo chgrp -R brew /usr/local
  4. change the permissions to add write to /usr/local as group: sudo chmod -R g+w /usr/local
  5. change homebrew cache directory group: sudo chgrp -R brew /Library/Caches/Homebrew
  6. change the homebrew cache directory permissions: sudo chmod -R g+w /Library/Caches/Homebrew

Single User Homebrew

If you’re not trying to use more than one user with Homebrew, then the solution provided by the other answers, based on the suggestions of brew doctor is probably sufficient:

sudo chown -R $(whoami) /usr/local

sudo chown -R $(whoami) /Library/Caches/Homebrew

Verification

After these steps, brew doctor should report success by any user in the brew group, assuming you’ve logged out and back in to apply the new group memberships (if you went the multiuser route). If you just corrected things for single user homebrew, then logging out and back in shouldn’t be necessary as none of your group memberships have changed.

https://stackoverflow.com/questions/26647412/homebrew-could-not-symlink-usr-local-bin-is-not-writable

Leave a Comment