Skip to content

Instantly share code, notes, and snippets.

@gdhardy1
Created September 20, 2020 03:17
Show Gist options
  • Save gdhardy1/12b10a3da75bfc5deea8887b8381c502 to your computer and use it in GitHub Desktop.
Save gdhardy1/12b10a3da75bfc5deea8887b8381c502 to your computer and use it in GitHub Desktop.

Completed and updated for Catalina (macOS 10.15.4)

Homebrew multi-user setup

Homebrew Multi User Setup

First, create a brew group and add users

Do this once

  1. sudo dseditgroup -o create brew Create a brew group
  2. sudo dseditgroup -o edit -a USER1 -t user brew Add first user
  3. sudo dseditgroup -o edit -a USER2 -t user brew Add second user

Then, change the installation directories

This might need to be repeated on occasion

  1. brew doctor Check to see how wrong things are
  2. sudo chgrp -R brew $(brew --prefix)/* Change the group of homebrew installation directory
  3. sudo chmod -R g+w $(brew --prefix)/* Allow group members to write inside this directory
  4. brew doctor Check to see how correct things are

Node.js Upgrade Permissions Error

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/[email protected]

  1. sudo chgrp -R brew /usr/local/var/homebrew/*
  2. sudo chmod -R g+w /usr/local/var/homebrew/*

As of 10.15.4

If you get these errors

Error: Failure while executing; `cp -pR /var/folders/.../. /usr/local/Cellar/...` exited with 1. Here's the output:
cp: utimes: /usr/local/Cellar/.../.: Operation not permitted
cp: chmod: /usr/local/Cellar/.../.: Operation not permitted

Per this Homebrew Community Discussion maybe the user currently running the Homebrew upgrade procedure has to the owner of all the Homebrew files? Because the brew group and it's membership are no longer sufficient?

sudo chown -R $(whoami):wheel $(brew --prefix)/*

I don't know, but this works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment