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