2009-05-21 00:04:11 +01:00
|
|
|
Homebrew
|
|
|
|
========
|
2009-09-04 18:37:06 +01:00
|
|
|
Homebrew is a package management system for OS X. In other words it is a tool
|
|
|
|
that helps you manage the installation of other open source software on your
|
|
|
|
Mac.
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-07-22 02:38:08 +01:00
|
|
|
Here's why you may prefer Homebrew to the alternatives:
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
1. Zeroconf installation
|
2009-09-02 14:41:36 +01:00
|
|
|
Copy the contents of this directory to /usr/local. Homebrew is now ready
|
|
|
|
for use.
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
2. Or… install anywhere!
|
2009-09-02 14:41:36 +01:00
|
|
|
You can actually stick this directory anywhere. Like ~/.local or /opt or
|
|
|
|
/lol if you like. You can even move this directory somewhere else later.
|
|
|
|
Homebrew never changes any files outside of its prefix.
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
3. The GoboLinux approach
|
|
|
|
Packages are installed into their own prefix (eg. /usr/local/Cellar/wget)
|
|
|
|
and then symlinked into the Homebrew prefox (eg. /usr/local).
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
This way packages can be managed with existing command line tools. You can
|
|
|
|
uninstall with rm -rf, list with find, query with du. It also means you
|
|
|
|
can easily install multiple versions of software or libraries and switch
|
|
|
|
on demand.
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
Of course you don't have to do anything by hand, we also provide a
|
|
|
|
convenient and fully-featured four-letter tool called brew.
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
4. You don't have to sudo
|
2009-09-02 14:41:36 +01:00
|
|
|
It's up to you. We recommend not--see the relevant later section.
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
5. Easy package creation
|
2009-09-02 14:41:36 +01:00
|
|
|
Packages are just Ruby scripts. Generate a template with:
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
brew mk http://foo.com/tarball-0.8.9.tgz
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
Homebrew will automatically open it for you to tweak with TextMate or
|
|
|
|
$EDITOR.
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
Or edit an existing formula:
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
brew edit foo
|
2009-07-24 15:10:01 +01:00
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
6. DIY package installation
|
2009-09-02 14:41:36 +01:00
|
|
|
MacPorts doesn't support the beta version? Need an older version? Need
|
|
|
|
custom compile flags? The Homebrew toolchain is carefully segregated so
|
|
|
|
you can build stuff by hand but still end up with package management.
|
2009-07-24 15:10:01 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
Just install to the Cellar and then call brew ln to symlink that
|
2009-09-04 18:37:06 +01:00
|
|
|
installation into your PATH, eg.
|
2009-08-12 13:43:51 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
./configure --prefix=/usr/local/Cellar/wget/1.10
|
|
|
|
make install
|
|
|
|
brew ln wget
|
2009-08-12 13:43:51 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
Or Homebrew can figure out the prefix:
|
2009-07-24 15:10:01 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
./configure `brew diy`
|
|
|
|
cmake . `brew diy`
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
This means you can also install multiple versions of the same package and
|
|
|
|
switch on demand.
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
7. Optimization
|
|
|
|
We optimise for (Snow) Leopard Intel, binaries are stripped, compile flags
|
|
|
|
tweaked. Slow software sucks.
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
8. Making the most of OS X
|
2009-09-02 14:41:36 +01:00
|
|
|
Homebrew knows how many cores you have thanks to RubyCocoa, so it makes
|
|
|
|
sure when it builds it uses all of them, (unless you don't want it to of
|
|
|
|
course).
|
2009-07-28 00:31:21 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
Homebrew knows exactly which Mac you have, and optimizes the software it
|
2009-09-04 18:37:06 +01:00
|
|
|
builds as well as it possibly can.
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
Homebrew can integrate with Ruby gems, CPAN and Python disttools. These
|
2009-09-04 18:37:06 +01:00
|
|
|
tools exist already and do the job great. We don't duplicate packaging
|
|
|
|
effort, we just improve on it by making these tools install with more
|
|
|
|
management options.
|
2009-09-02 14:41:36 +01:00
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
9. No duplication
|
2009-09-02 14:41:36 +01:00
|
|
|
MacPorts is an autarky. You get a duplicate copy of zlib, OpenSSL, Python,
|
|
|
|
etc. To cut a long story short, Homebrew doesn't. As a result everything
|
2009-09-04 18:37:06 +01:00
|
|
|
you install has less dependencies and builds significantly faster.
|
2009-09-02 14:41:36 +01:00
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
10. Fork with Git
|
|
|
|
The formula are all on git, so just fork to add new packages, or add extra
|
|
|
|
remotes to get packages from more exotic maintainers.
|
2009-09-02 14:41:36 +01:00
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
11. Surfing the cutting edge
|
2009-09-02 14:41:36 +01:00
|
|
|
If the package provides a git:// or svn:// url you can choose to install
|
|
|
|
that instead and then update as often as you like.
|
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
12. Homebrew has a beer theme
|
2009-09-02 14:41:36 +01:00
|
|
|
Beer goggles will help you to evangelise Homebrew more effectively.
|
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
13. Homebrew helps get you chicks
|
2009-09-02 14:41:36 +01:00
|
|
|
There's no conclusive scientific evidence as yet, but I firmly believe
|
|
|
|
it's just a matter of time and statistics.
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-07-22 20:27:58 +01:00
|
|
|
I know I've made it sound so awesome you can hardly wait to rip MacPorts out
|
2009-09-02 14:41:36 +01:00
|
|
|
and embrace the fresh, hoppy taste of Homebrew, but I should point out that it
|
2009-09-04 18:37:06 +01:00
|
|
|
is really new and still under heavy development. Eg. *dependency resolution
|
|
|
|
and updates are still manual*. Thanks!
|
2009-07-22 20:27:58 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
Max Howell -- <http://twitter.com/mxcl>
|
2009-05-21 00:04:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
Installation
|
|
|
|
============
|
2009-07-22 02:38:08 +01:00
|
|
|
Homebrew is zeroconf, but almost everything it installs is built from source;
|
|
|
|
so you need Xcode:
|
2009-06-05 12:56:28 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
<http://developer.apple.com/technology/xcode.html>
|
2009-06-05 12:56:28 +01:00
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
Many build scripts assume MacPorts or Fink on OS X. Which isn't a problem
|
|
|
|
until you uninstall them and stuff you built with Homebrew breaks. So
|
|
|
|
uninstall them (if you prefer renaming their root folders is sufficient).
|
2009-06-05 12:56:28 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
<http://trac.macports.org/wiki/FAQ#uninstall>
|
|
|
|
<http://www.finkproject.org/faq/usage-fink.php#removing>
|
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
Now, download Homebrew:
|
|
|
|
|
|
|
|
git clone git://github.com/mxcl/homebrew.git
|
|
|
|
|
|
|
|
If this leaves you shaking your head because you are installing Homebrew
|
|
|
|
*in order to* install git, then try this installer script:
|
|
|
|
<http://gist.github.com/179275>
|
|
|
|
|
|
|
|
Homebrew is self-contained so once you've put it somewhere, it's ready to go.
|
|
|
|
Copy this directory anywhere you like. But we recommend installing to
|
|
|
|
/usr/local because:
|
2009-06-05 12:56:28 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
1. It is already in your path
|
|
|
|
2. Build scripts always look in /usr/local for dependencies so it makes it
|
|
|
|
easier for you personally to build and install software
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
You can move the location of Homebrew at a later time, although this *will*
|
2009-09-04 18:37:06 +01:00
|
|
|
break some tools because they hardcode their installtion prefixes into their
|
|
|
|
binaries. Homebrew does make more effort than competing solutions to prevent
|
|
|
|
this though.
|
|
|
|
|
|
|
|
Finally, if you don't install to /usr/local, you have to add the following to
|
|
|
|
your ~/.profile file:
|
2009-07-28 00:31:21 +01:00
|
|
|
|
2009-09-04 18:37:06 +01:00
|
|
|
export PATH=`brew --prefix`/bin:$PATH
|
|
|
|
export MANPATH=`brew --prefix`/share/man:$MANPATH
|
|
|
|
|
|
|
|
Don't sudo
|
|
|
|
----------
|
2009-06-28 16:41:28 +01:00
|
|
|
Well clearly you can sudo if you like. Homebrew is all about you doing it your
|
2009-07-22 02:38:08 +01:00
|
|
|
way. But the Homebrew recommendation is: don't sudo!
|
|
|
|
|
|
|
|
On OS X, this requires your user to be in the admin group, but it doesn't
|
|
|
|
require sudo:
|
2009-06-28 16:41:28 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
cpan -i MP3::Info
|
2009-06-28 16:41:28 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
OS X is designed to minimise sudo use, you only need it for real-root-level
|
|
|
|
stuff. You know your /System and /usr are as clean and pure as the day you
|
|
|
|
bought your Mac because you didn't sudo. Sleep better at night!
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
If you are already the kind of guy who installed TextMate by dragging and
|
2009-07-22 02:38:08 +01:00
|
|
|
dropping it to /Applications, then you won't mind if libflac and pngcrush are
|
2009-09-02 14:41:36 +01:00
|
|
|
installed under your user privileges too. Lets face it; Homebrew is not
|
2009-07-22 02:38:08 +01:00
|
|
|
installing anything system-critical. Apple already did that.
|
2009-06-28 16:41:28 +01:00
|
|
|
|
2009-07-22 02:38:08 +01:00
|
|
|
Let this be the last sudo you do for quite some time:
|
2009-06-28 16:41:28 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
sudo chown -R `whoami`:staff `brew --prefix`
|
2009-07-22 02:38:08 +01:00
|
|
|
|
|
|
|
I already have a bunch of junk in /usr/local
|
|
|
|
--------------------------------------------
|
2009-09-02 14:41:36 +01:00
|
|
|
Yeah, that's typical. You can either just merge this folder into what is
|
|
|
|
already there -- it's perfectly safe, Homebrew will never touch the other
|
|
|
|
files. Or you can make a note of what is already there and reinstall those
|
|
|
|
packages using Homebrew after deleting /usr/local.
|
2009-07-22 02:38:08 +01:00
|
|
|
|
|
|
|
How about mate and gitx and that?
|
|
|
|
---------------------------------
|
2009-09-02 14:41:36 +01:00
|
|
|
These tools install from TextMate and GitX into /usr/local/bin. They (and
|
|
|
|
other similar tools) can co-exist with Homebrew without requiring further
|
|
|
|
effort from yourself.
|
|
|
|
|
2009-06-28 16:41:28 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
Uninstallation
|
|
|
|
==============
|
|
|
|
cd `brew --prefix`
|
|
|
|
rm -rf Cellar Library
|
|
|
|
rm bin/brew .gitignore README
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
|
|
|
|
Sample Usage
|
|
|
|
============
|
2009-05-21 00:04:11 +01:00
|
|
|
Install wget:
|
2009-09-02 14:41:36 +01:00
|
|
|
|
2009-06-04 20:03:53 +01:00
|
|
|
brew install wget
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-07-22 02:38:08 +01:00
|
|
|
Update package list:
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
cd /usr/local && git pull
|
|
|
|
|
|
|
|
Two ways to delete a package:
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
brew rm wget
|
|
|
|
rm -rf /usr/local/Cellar/wget && brew prune
|
|
|
|
|
|
|
|
Two ways to list all files in a package:
|
|
|
|
|
|
|
|
brew list wget
|
|
|
|
find /usr/local/Cellar/wget
|
2009-05-21 00:04:11 +01:00
|
|
|
|
|
|
|
Search for a package to install:
|
2009-09-02 14:41:36 +01:00
|
|
|
|
2009-07-22 02:38:08 +01:00
|
|
|
ls /usr/local/Library/Formula/
|
2009-05-21 00:04:11 +01:00
|
|
|
|
|
|
|
Search for a package already installed:
|
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
ls /usr/local/Cellar/
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
Two ways to compute installed package sizes:
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
brew info wget
|
|
|
|
du /usr/local/Cellar/wget
|
2009-05-21 12:38:34 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
Show expensive packages:
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
du -md1 /usr/local/Cellar
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
A more thorough exploration of the brew command is available at the [Homebrew
|
|
|
|
wiki][wiki].
|
2009-05-21 00:04:11 +01:00
|
|
|
|
|
|
|
|
2009-06-28 16:41:28 +01:00
|
|
|
CPAN, EasyInstall, RubyGems
|
|
|
|
===========================
|
|
|
|
Homebrew doesn't reinvent the wheel. These tools are already designed to make
|
2009-09-02 14:41:36 +01:00
|
|
|
it easy to install Perl, Python and Ruby tools and libraries. So we insist
|
2009-06-28 16:41:28 +01:00
|
|
|
that you use them. However we don't think you should have to sudo, or install
|
2009-09-02 14:41:36 +01:00
|
|
|
to /usr, so we suggest you adapt the tools to install into Homebrew's prefix.
|
2009-06-28 16:41:28 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
There are preliminary instructions on the [wiki][].
|
2009-06-28 16:41:28 +01:00
|
|
|
|
|
|
|
|
2009-07-22 02:38:08 +01:00
|
|
|
Contributing New Formulae
|
|
|
|
=========================
|
2009-09-04 18:37:06 +01:00
|
|
|
Formulae are simple Ruby scripts. Generate a formula with most bits filled-in:
|
2009-06-18 10:32:53 +01:00
|
|
|
|
2009-09-07 01:34:40 +01:00
|
|
|
brew create http://foo.org/foobar-1.2.1.tar.bz2
|
2009-06-26 12:59:19 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
Check it over and try to install it:
|
2009-06-26 12:59:19 +01:00
|
|
|
|
|
|
|
brew install foobar
|
2009-06-18 10:32:53 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
Check the [wiki][] for more detailed information and tips about contribution.
|
2009-06-02 13:39:39 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
If you want your formula to become part of this distribution, fork
|
|
|
|
<http://github.com/mxcl/homebrew> and ask mxcl to pull. Alternatively maintain
|
|
|
|
your own distribution. Maybe you want to support Tiger? Or use special compile
|
|
|
|
flags? Go ahead that's what git is all about! :)
|
2009-06-26 12:59:19 +01:00
|
|
|
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-08-31 16:01:36 +01:00
|
|
|
Licensing
|
|
|
|
=========
|
2009-09-04 18:37:06 +01:00
|
|
|
Homebrew is mostly BSD licensed although you should refer to each file to
|
|
|
|
confirm. Individual formulae are licensed according to their authors wishes.
|
2009-08-31 16:01:36 +01:00
|
|
|
|
|
|
|
|
2009-05-21 00:04:11 +01:00
|
|
|
FAQ
|
|
|
|
===
|
2009-09-02 14:41:36 +01:00
|
|
|
1. Are you excessively interested in beer?
|
|
|
|
Yes.
|
|
|
|
|
|
|
|
2. Was Homebrew devised under the influence of alcohol?
|
|
|
|
Yes.
|
|
|
|
|
2009-09-07 01:34:40 +01:00
|
|
|
3. Can Homebrew replace MacPorts?
|
|
|
|
Maybe. But remember, Homebrew is still incomplete. Be forgiving in your
|
|
|
|
approach and be willing to fork and contribute fixes. Thanks!
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
[wiki]: http://wiki.github.com/mxcl/homebrew
|