Homebrew recommends being installed in /usr/local/; This is not always possible for systems that are managed in corporate environments where permissions will restrict user ownership of Homebrew. If a user doesn’t own Homebrew they will not be able to add packages or update.
The following is a super simple way to run Homebrew from a users home directory. Note if you are installing Homebrew for another user on the system (not the account you are logged in as) then you will need to either su into the other account or login as the user for which you want the package to be run from.
Install Homebrew
Clone Homebrew From Git
cd $HOME
git clone https://github.com/mxcl/homebrew.git
Add Homebrew To Your Path (Bash Example)
export PATH=${HOME}/homebrew/bin:${PATH}
Test for Success
brew doctor
The above command should display the following:
“Warning: Your Homebrew’s prefix is not /usr/local. You can install Homebrew anywhere you want but some bottles (binary packages) can only be used with a /usr/local prefix and some formulae (packages) may not build correctly with a non-/usr/local prefix.”
If the above text is displayed then you know Homebrew is working from your home directory.
Further Setup
Add Export Path to Users Bash Profile
vi ~/.bash_profile
Add the Export Statement
# Homebrew
export PATH=${HOME}/homebrew/bin:${PATH}
Force Reload Bash Profile
source ~/.bash_profile
Done!