Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Homebrew nicely allows package installations without sudo privileges, but it seems that I need admin privileges to install Homebrew itself.

I'd like to install Homebrew in a Mac environment where I don't have sudo or admin privileges. Is this possible?

share|improve this question
up vote 9 down vote accepted

No.. Unless you do significant surgery.

The reason is that Homebrew strongly insists on installing packages into /usr/local. In fact, even if you forced it to install somewhere else, you are likely to break dependencies when you use brew install to install packages. Most if not all of these packages are pre-compiled and linked expecting to live in /usr/local.

The reason for this insistence is that /usr/local is precisely where POSIX recommends that stuff like this gets installed. In order to create /usr/local Homebrew needs temporary admin credentials to create the directory and assign ownership.

This, in turn, is what allows you to install anything else without elevating credentials.

share|improve this answer
Thanks, but I think you missed my question. I know how & where it installs packages, but I want to install Homebrew without admin or sudo. – BenjaminGolder Jul 14 '13 at 1:17
I didn't miss your question. The answer was "No".. I just said "Yes" accidentally. You cannot easily do what you are asking and even if you forced it by editing the Homebrew installer to put things into a branch off of your home directory, more than likely lots of brews would fail after installation. – David Hoelzer Jul 14 '13 at 1:18
okay, thanks. I was confused by the previous "Yes". – BenjaminGolder Jul 14 '13 at 1:25


I modified the install script to not use sudo and to use a directory of your choice.

Download that, set YOUR_HOME in the script to the absolute path. chmod +x the script. Create the YOUR_HOME/usr/local directory. Then, execute the script.


In .bash_profile, I set (I'm not positive this is important, pretty sure):

export HOMEBREW_PREFIX=/The/path/to/YOUR_HOME/usr/local

Now, I can:

brew install wget

Make sure the bin directory, YOUR_HOME + /usr/local/bin is on your $PATH.

which wget
share|improve this answer
In the install script I had to add #{YOUR_HOME} prefix to the HOMEBREW_CACHE variable as well. That, and because the system admin already had homebrew installed, I had to add export PATH=/path/to/home/usr/local/bin:$PATH to .bash_profile as well. But with all that, it seems to work great. – golmschenk Jun 26 '15 at 19:31
Just went through the process again, and I just wanted to mention you also have to make a usr directory in your home directory before the script will run. Additionally, when you add #{YOUR_HOME} to the HOMEBREW_CACHE variable, it seems you need to change the single quotes to double quotes for it to work. So there are a few steps, but it's definitely worth it to get the power of Homebrew. – golmschenk Jul 20 '15 at 17:01
@golmschenk double quotes are required for ruby's string formatting to kick in, I believe. – Skylar Saveland Jul 24 '15 at 20:14
That's a nice adjustment. You really ought to submit a pull request to the home-brew project. – David Hoelzer Dec 5 '15 at 19:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .