Skip to content
Sharpie edited this page Aug 25, 2011 · 52 revisions

How do I update my local packages?

First update the formulas and homebrew itself:

brew update

Afterwards install newer versions of updated packages with:

brew install $(brew outdated)

or upgrade all formulas with:

brew upgrade

You can find out what changed by:

cd `brew --prefix`
git remote add origin https://github.com/mxcl/homebrew.git
git fetch origin
git diff HEAD..origin/master --summary

How do I uninstall Homebrew?

Generally just delete the directory Homebrew is in. If you installed to /usr/local then you may prefer the following steps:

cd `brew --prefix`
rm -rf Cellar
brew prune
rm `git ls-files`
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions
rm -rf .git
rm -rf ~/Library/Caches/Homebrew

DON’T JUST RUN THAT WITHOUT UNDERSTANDING IT AND CHECKING IT’S OK FIRST!

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 (i.e., without brew) added new stuff there, in which case those things will still be there too.

Where does stuff get downloaded?

`brew --cache`

Which is usually: ~/Library/Caches/Homebrew

My GUI .apps don’t find /usr/local/bin utilities!

GUI apps on OS X don’t have /usr/local/bin in their PATH by default. You fix this by following these instructions: http://developer.apple.com/library/mac/#qa/qa1067/_index.html.

Note that you should put /usr/local/bin after /usr/bin because some programs will expect to get the system version of eg. ruby, and break if they get the newer Homebrew version.

How do I contribute to Homebrew?

See the Formula Cookbook.

bad interpreter: /usr/bin/ruby^M: no such file or directory

You cloned with git, and your git configuration is set to use Windows line endings. Don’t do that.

bad interpreter: /usr/bin/ruby

You don’t have a /usr/bin/ruby or it is not executable. It’s not recommended to let this persist, you’d be surprised how many .apps, tools and scripts expect your OS X provided files and directories to be unmodified since OS X was installed.

Why are you compiling everything?

Projects distribute source tarballs, generally, but if they provide a good binary, we’ll use it. Though we don’t always, because Homebrew is about homebrewing, it’s half the point that you can just brew edit foo and change how the formula is compiled to your own specification.

Homebrew does provide pre-compiled versions for some formula that take a long time to compile (such as Qt which can take many hours to build). These pre-compiled versions are referred to as bottles and are available at:

https://sourceforge.net/projects/machomebrew/files

If available, bottled binaries will be used by default except under the following conditions:

  • Options were passed to the the install command. I.E. brew install foo will use a bottled version of foo, but brew install foo --enable-bar will trigger a source build.
  • The --build-from-source option is invoked.
  • The environment variable HOMEBREW_BUILD_FROM_SOURCE is set.
  • The machine is not running OS X 10.7.x as all bottled builds are generated on Lion.

In order to completely disable bottled builds, simply add a value for the environment variable HOMEBREW_BUILD_FROM_SOURCE to your profile.

How do I get a formula from someone else’s branch?

gem install github
cd $(brew --prefix)
github pull someone_else

someone_else is the github username. It assumes a branch named master, if you want a different branch then do github pull someone_else/branch_name.

Why does Homebrew insist I install to /usr/local with such vehemence?

  1. It’s easier
    /usr/local/bin is already in your PATH.
  2. It’s easier
    Tons of build scripts break if their dependencies aren’t in either /usr or /usr/local. We fix this for Homebrew formulae (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.
  3. It’s safe
    Apple has conformed to POSIX and left this directory for us. Which means there is no /usr/local directory by default, so there is no need to worry about messing up existing tools.
If you plan to install gems that depend on brews then save yourself a bunch of hassle and install to /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!”

Why does Homebrew say sudo is bad?

tl;dr Sudo is dangerous, and you installed TextMate.app without sudo anyway.

Homebrew is designed to work without using sudo. You can decide to use it but we strongly recommend not to do so. If you have used sudo and run into a bug then it is likely to be the cause. Please don’t file a bug report unless you can reproduce it after reinstalling Homebrew from scratch without using sudo.

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, we’ve seen some build scripts try to modify /usr even when the prefix was specified as something else entirely.

Did you chown root /Applications/TextMate.app? Probably not. So is it that important to chown root wget?

Clone this wiki locally