Brew Multiuser

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)