| CARVIEW |
Installation
tl;dr
Run this script and then install Xcode.
Homebrew is now installed in the default and recommended way and you’ve saved a bunch of reading.
And now for all the other stuff that you should read, but we’ll forgive you if you don’t (just this once):
Requirements
1 Not all brews have CPU or OS requirements, but you can assume you will have trouble if you don’t conform. Also, you can find PowerPC and Tiger branches from other users in the fork tree.
2 Homebrew itself does not depend on Xcode and not all formula require Xcode. Homebrew will still attempt to install formula if Xcode is not installed; this is so people can create custom Homebrew installations that eg. only install binaries.
We recommend you delete /usr/local/include and /usr/local/lib
Most likely you’ve done a bit of “homebrew” installation already. We’ve had a lot of bug reports that are first inexplicable and later it turns out that it’s because the user has some of their own libs and headers in /usr/local. Homebrew can’t stop gcc and other build tools from using these libraries. Before you install we strongly recommend you delete the contents of these two directories.
If in doubt, don’t delete this stuff, but be aware that this may cause build issues.
Location
You can put Homebrew anywhere, but some choices are better than others:
- Avoid directories that contain spaces
Homebrew tries to make this work, but some build scripts that formula execute don’t like spaces. - Avoid
/opt/localand/sw
These directories are already used by MacPorts and Fink. Some tools and build scripts expect to find things there and get confused if something else is there instead.
Do yourself a favour and pick /usr/local
- It’s easier
/usr/local/binis already in yourPATH. - It’s easier
Tons of build scripts break if their dependencies aren’t in either/usror/usr/local. We fix this for Homebrew formulas (although we don’t always test for it), but you’ll find that many RubyGems and Python setup scripts break which is something outside our control. - It’s safe
Apple has conformed to POSIX and left this directory for us. Which means there is no/usr/localdirectory by default, so there is no need to worry about messing up existing tools.
/usr/local!It is not trivial to tell gem to look in non-standard directories for headers and dylibs. If you choose /usr/local, everything “just works!”
Installing to /usr/local
Homebrew will happily coexist with any existing stuff you have installed in /usr/local.
This script is the recommended way to install to /usr/local. It does a lot of checks, and makes the minimum of permissions changes to ensure you can brew without sudo.
If you’re the DIY sort and know what you are doing then you can just run this:
sudo chown -R $USER /usr/local curl -Lsf https://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C/usr/local
If you are happy to sudo your brews, then just untar into /usr/local:
curl -Lsf https://github.com/mxcl/homebrew/tarball/master | sudo tar xvz --strip 1 -C/usr/local
Installing anywhere else
Just grab the master tarball and extract it anywhere you like. Homebrew is self-contained and will install its brews into its extracted directory. Just make sure you add the bin directory to your PATH, or always call the brew tool via its full path.
Sudo
tl;dr Sudo is dangerous, and you installed TextMate.app without sudo anyway.
Homebrew works with or without sudo.
So it is up to you.
However, you should only ever sudo a tool you trust. Of course, you can trust Homebrew ;) But do you trust the multi-megabyte Makefile that Homebrew runs? Developers often understand C++ far better than they understand make syntax. It’s too high a risk to sudo such stuff. It could break your base system, or alter it subtly.
And indeed, I have seen some build scripts try to modify /usr even when the prefix was specified as something else entirely.
Also:
- Did you
chown root /Applications/TextMate.app? Probably not. So is it that important tochown root wget? - You can always
sudo installspecific packages if you like.
Some stuff should be installed chown root. And in those cases install without sudo and then do this:
brew list foo | xargs sudo chown root
Uninstallation
cd `brew --prefix` rm -rf Cellar brew prune rm -rf Library .git .gitignore bin/brew README.md
It is worth noting that if you installed somewhere like /usr/local then these uninstallation steps will leave that directory exactly like it was before Homebrew was installed. Unless you manually (ie. without brew) added new stuff there, in which case those things will still be there too.
Alternate Installation Style
You can also install Homebrew into eg. ~/.homebrew and then symlink the brew command into /usr/local/bin.
Multiple installations
Create a Homebrew installation wherever you extract the tarball. Whichever brew command is called is where the packages will be installed. You can use this as you see fit, eg. a system set of libs in /usr/local and tweaked formula for development in ~/homebrew.
