Skip to content

Instantly share code, notes, and snippets.

@bbonamin
Created February 18, 2016 10:50
Show Gist options
  • Save bbonamin/808a55efb746d8a10430 to your computer and use it in GitHub Desktop.
Save bbonamin/808a55efb746d8a10430 to your computer and use it in GitHub Desktop.
OS X Homebrew with multiple users
http://apple.stackexchange.com/a/45003
Is this considered bad? I thought one of the advantages of using /usr/local/ for your installs was that you don't need sudo. But clearly we do.
Homebrew, by default, sets itself up for single-user access to /usr/local. So you need to open up the permissions on the directory tree for it to be administered by more than one person.
People don't need to run sudo here to administer homebrew. You just need to change some permissions. Since you already have:
All users who would need to modify Homebrew are members of admin group.
You need to do two more things:
Make sure everything under /usr/local belongs to the group admin; and
Make sure anyone from the group admin can write to anything under /usr/local.
In this case the changes to make are:
chgrp -R admin /usr/local
chmod -R g+w /usr/local
chgrp -R admin /Library/Caches/Homebrew
chmod -R g+w /Library/Caches/Homebrew
chmod -R g+w /Library/Caches/Homebrew
For homebrew cask
chgrp -R admin /opt/homebrew-cask
chmod -R g+w /opt/homebrew-cask
And any user from the admin group should be able to manage the homebrew installation on the machine. If you need to add a user to the admin group this can be accomplished like this:
dseditgroup -o edit -a <username> -t user admin
(that user will need to login again to have the privileges granted).
For sanity on the machine, you may want to consider creating your own fork of Homebrew and have your local homebrew git repository point to the local fork. That lets you customize Homebrew for your environment and control the versions of packages that people are able to install with the brew command. With multiple people doing installs you could run in to version issues or dependency issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment