Perfect. Let's set up a shared dev group so all dev users on your Mac can use and manage Homebrew safely and cleanly.
This setup will:
- Create a group called
dev - Add all your developer users to that group
- Set group ownership of Homebrew directories to
dev - Give group write permissions so everyone can install/update formulas
sudo dseditgroup -o create devIf it already exists, you'll get a message — that's fine.
Replace username1, username2, etc. with actual short usernames of your dev accounts:
sudo dseditgroup -o edit -a sai -t user dev
sudo dseditgroup -o edit -a skv -t user devYou can repeat for as many users as you want.
This sets the dev group as the owning group:
sudo chown -R :dev /opt/homebrewAllow all group members to write:
sudo chmod -R g+w /opt/homebrewIf you want to be stricter, you can fine-tune specific subdirectories, but this is safe for a trusted dev group.
This ensures any new files/directories created in /opt/homebrew inherit the group dev:
sudo find /opt/homebrew -type d -exec chmod g+s {} \;