Skip to content

Instantly share code, notes, and snippets.

@cburyta
Last active August 29, 2015 14:19
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 cburyta/9ecaa7463086c6484480 to your computer and use it in GitHub Desktop.
Save cburyta/9ecaa7463086c6484480 to your computer and use it in GitHub Desktop.
Fix / set homebrew multiuser permissions
#!/bin/bash
# reference: http://blog.strug.de/2012/06/my-homebrew-multi-user-setup/
# usage: bash -c "$(curl -fsSL https://gist.githubusercontent.com/cburyta/9ecaa7463086c6484480/raw/4f756d43fd1b7aebccec6ea49f30dd3b3faf76f0/fix-group-brew.sh)"
# stop if brew doctor fails
set -e
echo "Ensure we have a 'brew' group, if not exists create the brew group before continuing."
dscl . -read /Groups/brew
echo "Ensure the current user is in the brew group"
id $(whoami) | grep brew
echo "Ensure Homebrew install looks A-OK"
brew doctor
echo "... Change the group of homebrew installation directory"
sudo chgrp -R brew /usr/local
echo "... Allow group members to write inside this directory"
sudo chmod -R g+w /usr/local
echo "... Change the group of homebrew cache directory"
sudo chgrp -R brew /Library/Caches/Homebrew
echo "... Allow group members to write inside this directory"
sudo chmod -R g+w /Library/Caches/Homebrew
echo "... Checking brew doctor again"
brew doctor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment