Skip to content

Setting up Brew for Multiusers

Fraser Harris edited this page Oct 4, 2015 · 3 revisions

Fraser: Why is this here?

Shamelessly stolen from: http://blog.strug.de/2012/06/my-homebrew-multi-user-setup/ (Copied here in case the site goes down)

Assumptions: Brew is installed for the current user with admin

Step 1: Create new user

This can be done from the Mac System Preferences -> Users and Groups. Note, the new user does not need to be an admin.

Step 2: Verify user works

Login to the new user's account, open a terminal and type: brew doctor
You should get output similar to that below:

divwad:~ testuser$ brew doctor
Warning: /usr/local/etc isn't writable.
This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a brew tries to write a file to this directory, the
install will fail during the link step.

You should probably `chown` /usr/local/etc

Warning: /usr/local/include isn't writable.
This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a brew tries to write a file to this directory, the
install will fail during the link step.

You should probably `chown` /usr/local/include

Warning: /usr/local/lib isn't writable.
This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a brew tries to write a file to this directory, the
install will fail during the link step.

You should probably `chown` /usr/local/lib

Warning: /usr/local/share isn't writable.
This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a brew tries to write a file to this directory, the
install will fail during the link step.

You should probably `chown` /usr/local/share

Warning: Some directories in /usr/local/share/man aren't writable.
This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a brew tries to add locale information to one of these
directories, then the install will fail during the link step.
You should probably `chown` them:

    /usr/local/share/man
    /usr/local/share/man/man1
    /usr/local/share/man/man3
    /usr/local/share/man/man5
    /usr/local/share/man/man7
    /usr/local/share/man/man8

Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:

    git
    git-cvsserver
    git-receive-pack
    git-shell
    git-upload-archive
    git-upload-pack

Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
    echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile

Step 3: Create a brew group

Log back in to the admin user and reopen System Preferences -> Users and Groups. Unlock this screen and press the lower left +. Select the account type Group and name it brew. After creating this group add all users you want to have access to homebrew.

Step 4: chgrp all the things

Run the following commands in terminal from the admin user.
sudo chgrp -R brew /usr/local
sudo chmod -R g+w /usr/local
sudo chgrp -R brew /Library/Caches/Homebrew
sudo chmod -R g+w /Library/Caches/Homebrew

Step 5: Verify

Log back into the new user and run brew doctor. If everything worked then you should either have no warnings or the one below:

divwad:~ testuser$ brew doctor
Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:

    git
    git-cvsserver
    git-receive-pack
    git-shell
    git-upload-archive
    git-upload-pack

Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
    echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile

Just run the one-liner in the warning to get rid of this and you are done!

Clone this wiki locally