You'll find descriptions of how to do this, like on StackOverflow: How to use Homebrew on a Multi-user MacOS Sierra Setup.
It's said that using `sudo` is wrong.
It's said that using a per-user local version of brew is right, but...
1. it doesn't play well with `nvm` (see)
2. it is completely and entirely unsupported (see)
3. many packages don't support it (see)
4. many packages will install from source instead of a binary (see)
So the practical, quick and dirty solution is to just use `sudo` (see).
In my experience, if I recall correctly, homebrew on macOS 14 by default uses the group "admin" for where it installs things, and it sets the permissions to "read" and "execute" as needed already. The only thing missing are "write" permissions. And for the user to include brew binaries on their PATH.
Also, "Administrator" users on Macs are in group "admin" by default already too. I'm guessing if your user is using brew, they're probably a macOS "Administrator" too (or else why would you let them use a global brew install?).
So I just ran in Terminal:
$ sudo chmod -R g+w $(brew --prefix)
Then for the user that wants to use brew, put in their home directory's ".zprofile" file:
eval "$(/opt/homebrew/bin/brew shellenv)"
To ensure brew is working for them, run in their Terminal: $ brew doctor
Warning: this is unsupported, and it's said to be wrong, and you're letting all Admin users on that machine to share one single installation of homebrew!
If roommates fight over fridge space, you've got no one but yourself to blame for not buying each roommate their own fridge!
So what use-case does this safely enable? A single human with multiple macOS user profiles to isolate their work space while sharing (with themselves!) the same global brew install.
No comments:
Post a Comment