Enable multiple users to install software using homebrew
I installed homebrew using my other user account (which I use during work), but it is impossible to install software from my newly created personal account:
$ brew install unrar
Error: Cannot write to /usr/local/Cellar
A ls -dl /usr/local/Cellar/
shows that the directory is owned by my other user account.
How do I configure homebrew to allow multiple users to install software?
Solution 1:
set umask
for each user first. (.basrc or .profile or .bash_profile)
umask 0002 # group write permission
then give write permission for groups via /usr/local
recursively:
sudo chmod -R g+w /usr/local/
then change the owner to staff
sudo chgrp -R staff /usr/local
now, each user, who is in staff
group can use brew install
and other brew related operations... Mostly every user is in that group.
Solution 2:
In case your account has root / su
/ sudo
access, you can try the following workaround:
su - myother_user_account -c "brew install ..."
sudo
alternative:
sudo -u myother_user_account brew install ...
A handy shell alias (for .bashrc
/.zshrc
/...):
alias brew="sudo -u myother_user_account brew"
Solution 3:
On the homebrew wiki, it mentions that you can install it anywere, try having local installations for each user.