Skip to content

Instantly share code, notes, and snippets.

@fkurz
Last active June 27, 2021 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fkurz/89090a655e21e8057d539e6549a27d5b to your computer and use it in GitHub Desktop.
Save fkurz/89090a655e21e8057d539e6549a27d5b to your computer and use it in GitHub Desktop.
Brew Permissions on macOS for Multiple Users

If you run a multi-user setup, Brew's doctor command will likely report lack of write permission on directories under /usr/local (e.g. /usr/local/etc).

The suggested fix is to chown -R $(whoami) ${directory} for all directories ${directory} without write permission by the current user. While this is a quick fix, it will force us to do the same procedure over again when we change to another user.

A better solution is to create a brew user group and add every user to this group that uses Brew as detailed in this blog post. While it's possible to add a user group via the command line. The simpler solution is to just use System Preferences > Users & Groups.

Once the group is created — called brew-users in this example — we can run the following to change the group for all files/directories managed by Brew (i.e. those stored under $(brew --prefix)) to the Brew user group and give the group writing privileges.

sudo chgrp -R brew-users $(brew --prefix)
sudo chmod -R g+w $(brew --prefix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment