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
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

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

Step 8: Get the brewer-kit.

$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

This will print something like the following to the screen:

==> This script will install:
/usr/local/bin/brew
/usr/local/Library/…
/usr/local/share/man/man1/brew.1
==> The following directories will be made group writable:
/usr/local/.
/usr/local/bin
/usr/local/etc
/usr/local/lib
==> The following directories will have their group set to admin:
/usr/local/.
/usr/local/bin
/usr/local/etc
/usr/local/lib

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

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:

E1/

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:

PATH=”/usr/local/bin:$PATH”
export PATH

save and $source ~/.bashrc

E2/

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:

/usr/local/share/man/de
/usr/local/share/man/de/man1

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

E3/

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!

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

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

  1. markthegraph says:

    Thanks

  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:
    DYLD_FALLBACK_LIBRARY_PATH
    DYLD_LIBRARY_PATH

  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 https://raw.github.com/Homebrew/homebrew/go/install)”
    from the official instructions on http://brew.sh/

  15. m.weiss says:

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

  16. johnny.deepen@hotmail.com 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?

please comment

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s