I’m a great fan of homebrew, the package manager for OS X that gives access to a raft of useful tools. However, it’s designed for a single user, really, which is OK for a developer’s laptop but less cool for a shared computer or one that uses network accounts. For these cases, here’s a solution.
I make the assumption here that you have the developer tools installed and know your way around the OS X Terminal/iTerm/etc.
Create a separate user account for homebrew, for example
brew. Give it a home directory of
/usr/local, make the
UID less than 500 (such as 401) and hide this user from the graphical logins. The following script does that lot for you.
#!/bin/bash dscl . create /Users/brew dscl . create /Users/brew RealName "Homebrew" dscl . create /Users/brew Password '*' dscl . create /Users/brew UniqueID 401 dscl . create /Users/brew PrimaryGroupID 80 dscl . create /Users/brew UserShell /bin/bash dscl . create /Users/brew NFSHomeDirectory /usr/local cp -R /System/Library/User\ Template/English.lproj /usr/local dseditgroup -o edit -a brew -t user staff chown -R brew:staff /usr/local
To hide the new user, run this as root:
defaults write /Library/Preferences/com.apple.loginwindow Hide500Users -bool YES