Sample Header Ad - 728x90

Homebrew multiuser on Monterey M1

2 votes
1 answer
1994 views
I am trying to setup a 2 user Homebrew configuration on my M1 Mac on Monterey. I have 2 accounts on the laptop: bob and work. bob will be the Homebrew owner, and work will access it via a sudo to bob. Following [this article](https://www.codejam.info/2021/11/homebrew-multi-user.html) , under sectiion "the good", I have installed homebrew into bob and have created a sudo alias in the .zshrc of work, my .zshrc contains
fpath+=("/opt/homebrew/share/zsh/site-functions")
alias brew='sudo -Hu bob brew'
However, when I run brew commands from work it is not working.
❯ brew
Password:
sudo: brew: command not found

~
❯ which brew
brew: aliased to sudo -Hu bob brew
These other articles were not helpful but linking here for completeness: - https://unix.stackexchange.com/questions/351513/multiuser-homebrew-privileges - https://unix.stackexchange.com/questions/598733/configuring-homebrew-for-multiple-users-on-macos
Asked by port5432 (969 rep)
Aug 25, 2022, 06:20 AM
Last activity: Oct 17, 2022, 05:01 AM