Install homebrew on your Mac (a tutorial)

Posted by

The homebrew package manager for mac is seriously awesome. Setting it up is a bit tricky if you don’t know what to do — and hopefully this post will help.

Step 1: The first thing you need to do is to install Xcode. Go to the App store and search for Xcode. Install it.

Step 2: wait … It is a BIG file, so it will take some time to download. If you are the impatient type, and want to check on progress, click into the ‘Updates’ tab. It should look something like this:

… except yours won’t be complete!

Step 3: Now open Xcode (the easiest way is to command-space and type in ‘Xcode’). You will see the Xcode welcome screen.

Step 4: Get an apple developer ID (if you do not have one). You can get it here, if you do not have one. You can sign in with your apple ID you have associated with your app-store and iTunes accounts.

Step 5: Go to Xcode preferences.

Step 6: Click on the ‘Downloads’ tab, and in the ‘Components’ section, select install for the Command Line Tools (wait again).

Step 7: open the terminal app (command-space to open spotlight, and type ‘terminal’) and check to see if ‘gcc’ is installed:

$ gcc --version

you should see something like this:

i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO

If you see that, you’re ready for step 8!

Step 8: Get the brewer-kit.

$ ruby -e "$(curl -fsSL"

This will print something like the following to the screen:

==> This script will install:
==> The following directories will be made group writable:
==> The following directories will have their group set to admin:

Press enter to continue
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin /usr/local/etc /usr/local/lib

You need only enter your ‘sudo’ Password and it will complete.

Step 9: Required fiddles — homebrew likes things to be a certain way. It’ll tell you what it’d like you to change:

$ brew doctor

I fixed the following errors on my laptop:


Consider amending your PATH so that /usr/local/bin
occurs before /usr/bin in your PATH.
you can do this via:

$ sudo vi /etc/paths

and then moving  /usr/local/bin on top of /usr/bin — however it’s not recommended.  I did that initially, but now prefer to edit my ~/.bashrc

$ vi ~/.bashrc

and adding the following:

export PATH

save and $source ~/.bashrc


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:


$ sudo chown [newowner] /usr/local/share/man/de
$ sudo chown [newowner] /usr/local/share/man/de/man1


Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn’t put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

$ mkdir -p ~/brewInstallBup/lib/pkgconfig/
$ mv /usr/local/lib/libt*.* ~/brewInstallBup/lib/

and now …

$ brew doctor
Your system is raring to brew.

Whoot! Almost done now …

Step 10: update (do this regularly)

$ brew update

and you’re done!


    1. It is a good tool. It took me weeks to figure it out the first time. Wish i had my tutorial handy … Which is pretty much why i wrote it.

  1. It works! I wanted to install gnuplot on my mac. And apparently, the easiest way to do so is to install install “homebrew” first, and then type the command “brew install gnuplot”. Thank you for the tutorial!!!

  2. Hello, I’m getting following error
    Warning: Setting DYLD_* vars can break dynamic linking.
    Set variables:

    1. Btw get yourself a github account, if you don’t have one. The help from the associated lists is excellent.

  3. Hi! Would you mind if I share your blog with my facebook group?
    There’s a lot of people that I think would really appreciate your content. Please let me know. Many thanks

  4. We absolutely love your blog and find many of your post’s to be precisely what
    I’m looking for. Does one offer guest writers
    to write content for you? I wouldn’t mind composing a post or elaborating on a
    number of the subjects you write with regards
    to here. Again, awesome web site!

    1. thanks, i made the update. please let me know if you find any more bugs. it’s been a few months since i did an install.

  5. Hi there! I’ve been trying hard to install Homebrew but for the last 24 hours I’ve been facing some password issues. I can’t work out what is the sudo password. I even had to reset my the root user on my mac, but I can’t move on. the cursor at the password prompt doesn’t even blimp. So I’m not sure what to do to be able to install Homebrew. Can someone out there help me?

    1. The sudo password is probably whatever your login password is. The cursor in terminal should not flash, this is normal.

  6. If I no longer need homebrew, is there anything i can do to undo the permissions changes in step 8?

  7. what’s the deal with all the permissions being reset from root to user? I am not comfortable with this! Any explanation?

Comments are closed.