Install homebrew on your Mac (a tutorial)

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!

This entry was posted in tech and tagged , . Bookmark the permalink.

29 Responses to Install homebrew on your Mac (a tutorial)

  1. markthegraph says:


  2. Pingback: Data analysis in Python | ricardian ambivalence

  3. Pingback: ricardian ambivalence

  4. vbnucro says:

    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!!!

  5. Pingback: Installing iterm2 and tmux on a mac | ricardian ambivalence

  6. Pingback: Iterm2 and tmux update | ricardian ambivalence

  7. Hurrah! In the end I got a website from where I can genuinely get helpful data regarding my study and knowledge.

  8. Kirit says:

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

  9. 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

  10. Codelambo says:

    You simply save my life… thanks so much…

  11. Alejandro says:

    This is my first time visit att here and i am actually pleasant to rewad all at single place.

  12. 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!

  13. Reblogged this on rationalspace and commented:
    Homebrew (package manager) installation on mac.

  14. John says:

    Thanks but these instructions are out-of-date, the ruby line doesn’t work as that page redirects. It should say
    ruby -e “$(curl -fsSL”
    from the official instructions on

  15. m.weiss says:

    Thank you!!! You helped me s much! =)

  16. says:

    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?

  17. 2sourapples says:

    What if there isn’t a “command line tools” under components?

  18. nunun says:

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

  19. Raf says:

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

please comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.