Do this once
sudo dseditgroup -o create brewCreate a brew groupsudo dseditgroup -o edit -a USER1 -t user brewAdd first usersudo dseditgroup -o edit -a USER2 -t user brewAdd second user
This might need to be repeated on occasion
brew doctorCheck to see how wrong things aresudo chgrp -R brew $(brew --prefix)/*Change the group of homebrew installation directorysudo chmod -R g+w $(brew --prefix)/*Allow group members to write inside this directorybrew doctorCheck to see how correct things are
If the error below appears when running brew upgrade, change the ownership and permissions with the commands further down
Error: Permission denied @ rb_sysopen - /usr/local/var/homebrew/locks/node@10.formula.lock
sudo chgrp -R brew /usr/local/var/homebrew/*sudo chmod -R g+w /usr/local/var/homebrew/*