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-24 18:54:27 +01:00
|
|
|
1. Zero configuration 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)
|
2009-09-11 14:48:51 +01:00
|
|
|
and then symlinked into the Homebrew prefix (eg. /usr/local).
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-12-05 13:33:22 +00:00
|
|
|
This way the filesystem is the package database and packages can be
|
|
|
|
managed with existing command line tools. For example, you can
|
2009-09-04 18:37:06 +01:00
|
|
|
uninstall with rm -rf, list with find, query with du. It also means you
|
2009-12-05 13:33:22 +00:00
|
|
|
can install multiple versions of software or libraries and switch
|
2009-09-04 18:37:06 +01:00
|
|
|
on demand.
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-12-05 13:33:22 +00:00
|
|
|
Of course, you don't have to do anything by hand, we also provide a
|
2009-09-04 18:37:06 +01:00
|
|
|
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-12-05 13:33:22 +00:00
|
|
|
It's up to you.
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-12-05 13:33:22 +00:00
|
|
|
5. Create new package descriptions in seconds
|
|
|
|
Package descriptions (formula) are simple Ruby scripts. Generate a
|
|
|
|
template with:
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-10-09 03:25:49 +01:00
|
|
|
brew create http://foo.com/tarball-0.8.9.tgz
|
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-12-05 13:33:22 +00:00
|
|
|
6. Package descriptions not required
|
2009-09-02 14:41:36 +01:00
|
|
|
MacPorts doesn't support the beta version? Need an older version? Need
|
2009-10-09 03:25:49 +01:00
|
|
|
custom compile flags? The Homebrew tool-chain is carefully segregated so
|
2009-09-02 14:41:36 +01:00
|
|
|
you can build stuff by hand but still end up with package management.
|
2009-07-24 15:10:01 +01:00
|
|
|
|
2009-10-09 03:25:49 +01:00
|
|
|
Just install to the Cellar and then call brew link 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-04 18:37:06 +01:00
|
|
|
7. Optimization
|
2009-10-09 03:25:49 +01:00
|
|
|
We optimize for (Snow) Leopard Intel, binaries are stripped, compile flags
|
|
|
|
are tuned to your exact Mac model. 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-10-09 03:25:49 +01:00
|
|
|
A touch of RubyCocoa, a cheeky sysctl query or two and a smattering of
|
|
|
|
FSEvent monitoring. In these manic days of cross-platform development,
|
2009-12-08 19:55:14 +00:00
|
|
|
it's can be a welcome relief to use something that is better because
|
2009-10-09 03:25:49 +01:00
|
|
|
it isn't too generalized.
|
2009-07-28 00:31:21 +01:00
|
|
|
|
2009-10-09 03:25:49 +01:00
|
|
|
9. No duplication
|
|
|
|
MacPorts is an autarky -- you get a duplicate copy of zlib, OpenSSL,
|
2009-12-05 13:33:22 +00:00
|
|
|
Python, etc. Homebrew uses what is already there, and consequently,
|
|
|
|
most stuff has zero dependencies and builds faster.
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-12-08 19:55:14 +00:00
|
|
|
We resist packaging stuff that is already packaged. So we have a [wiki page][wiki]
|
|
|
|
that describes how best to use RubyGems, Pip (or easy_install) and
|
2009-12-05 13:33:22 +00:00
|
|
|
CPAN with OS X and Homebrew.
|
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-10-09 03:25:49 +01:00
|
|
|
If the package provides a git://, svn://, cvs:// or hg:// url you can
|
|
|
|
choose to install that instead and then update as often as you like.
|
2009-09-02 14:41:36 +01:00
|
|
|
|
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-12-05 17:58:21 +00:00
|
|
|
13. Homebrew can help you hook up
|
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-12-05 13:33:22 +00:00
|
|
|
I know I've made it sound so awesome you can hardly wait to embrace the fresh,
|
|
|
|
hoppy taste of Homebrew, but I should point out that it is really new and
|
|
|
|
still under heavy development. Also:
|
2009-09-12 19:04:15 +01:00
|
|
|
|
|
|
|
1. It's a little more hands-on than the competition. For example, we don't
|
2009-12-05 13:33:22 +00:00
|
|
|
set up PostgreSQL for you after installing it, but we do provide
|
2009-09-12 19:04:15 +01:00
|
|
|
instructions. This isn't apathy, it's by design -- Homebrew doesn't make
|
|
|
|
assumptions about how you want your software to run. You have to have some
|
|
|
|
knowledge or be willing to learn to use Homebrew for some tasks.
|
|
|
|
|
|
|
|
2. Dependency resolution and updates are basic or not working yet.
|
|
|
|
|
2009-12-04 10:48:37 +00:00
|
|
|
3. We don't support PowerPC or OS X less than Tiger (though you could always
|
|
|
|
maintain your own fork for such things if you like…)
|
|
|
|
|
2009-12-08 19:55:14 +00:00
|
|
|
Max Howell — <http://twitter.com/mxcl>
|
2009-05-21 00:04:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
Installation
|
|
|
|
============
|
2009-12-05 13:33:22 +00:00
|
|
|
You can install Homebrew anywhere:
|
2009-06-05 12:56:28 +01:00
|
|
|
|
2009-10-23 14:46:59 +01:00
|
|
|
mkdir homebrew
|
|
|
|
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C homebrew
|
2009-09-04 18:37:06 +01:00
|
|
|
|
2009-10-23 14:46:59 +01:00
|
|
|
Homebrew can already be used, try it:
|
2009-06-05 12:56:28 +01:00
|
|
|
|
2009-12-08 19:55:14 +00:00
|
|
|
homebrew/bin/brew install pip
|
|
|
|
homebrew/bin/brew list pip
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-12-08 19:55:14 +00:00
|
|
|
Notice how Pip was installed to homebrew/bin/pip — Homebrew never touches
|
|
|
|
files outside of its prefix.
|
2009-09-04 18:37:06 +01:00
|
|
|
|
2009-12-08 19:55:14 +00:00
|
|
|
But… we recommend installing to /usr/local because:
|
|
|
|
---------------------------------------------------
|
2009-10-23 14:46:59 +01:00
|
|
|
1. It's already in your PATH
|
2009-12-08 19:55:14 +00:00
|
|
|
2. It makes it easier to install other stuff like Ruby Gems
|
2009-12-05 13:33:22 +00:00
|
|
|
|
2009-12-08 19:55:14 +00:00
|
|
|
Build tools all look to /usr/local for library dependencies and thus you can
|
|
|
|
get on with building your own gems and not worry about having to Google for
|
|
|
|
unnecessary build assistance.
|
2009-09-04 18:37:06 +01:00
|
|
|
|
2009-10-23 14:46:59 +01:00
|
|
|
But… don't sudo!
|
|
|
|
----------------
|
2009-12-05 13:33:22 +00:00
|
|
|
Homebrew can be used with or without sudo, but, OS X was designed to
|
|
|
|
minimise sudo use, you only need it occasionally. For example, as long as your
|
|
|
|
user is in the admin group, this just works:
|
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-12-05 13:33:22 +00:00
|
|
|
Using sudo all the time is annoying, but far worse — it conditions you to type
|
|
|
|
in your root password without thinking about it. Homebrew compliments OS X
|
|
|
|
so you are unlikely to install anything that really needs to be chown:root.
|
|
|
|
Let this be your last sudo for some time:
|
2009-06-28 16:41:28 +01:00
|
|
|
|
2009-10-23 14:46:59 +01:00
|
|
|
sudo chown -R `whoami` /usr/local
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-12-05 13:33:22 +00:00
|
|
|
_NOTE_: If you already installed, eg. MySQL into /usr/local then the recursive
|
|
|
|
chown _may_ break it. Fixing MySQL should be as simple as:
|
2009-10-22 10:03:43 -05:00
|
|
|
|
2009-12-05 13:33:22 +00:00
|
|
|
sudo chown -R mysql:mysql /usr/local/mysql
|
2009-10-23 14:46:59 +01:00
|
|
|
|
|
|
|
Installing to /usr/local
|
|
|
|
------------------------
|
|
|
|
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local
|
|
|
|
|
2009-12-05 13:33:22 +00:00
|
|
|
Homebrew can co-exist with any software already installed in its prefix.
|
|
|
|
|
2009-12-08 19:55:14 +00:00
|
|
|
Installing with Git
|
|
|
|
-------------------
|
2009-10-09 03:25:49 +01:00
|
|
|
cd /usr/local
|
|
|
|
git init
|
|
|
|
git remote add origin git://github.com/mxcl/homebrew.git
|
|
|
|
git pull origin master
|
|
|
|
|
2009-12-08 19:55:14 +00:00
|
|
|
One last important caveat
|
|
|
|
-------------------------
|
2009-10-23 14:46:59 +01:00
|
|
|
Almost everything Homebrew installs is written in C, so you need Xcode:
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-10-23 14:46:59 +01:00
|
|
|
<http://developer.apple.com/technology/xcode.html>
|
|
|
|
|
2009-06-28 16:41:28 +01:00
|
|
|
|
2009-09-02 14:41:36 +01:00
|
|
|
Uninstallation
|
|
|
|
==============
|
|
|
|
cd `brew --prefix`
|
2009-09-07 05:33:36 +08:00
|
|
|
rm -rf Cellar
|
|
|
|
brew prune
|
2009-12-08 19:55:14 +00:00
|
|
|
rm -rf Library .git .gitignore bin/brew README.md
|
2009-09-22 00:04:55 +01:00
|
|
|
|
|
|
|
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 added new stuff there, in which
|
|
|
|
case those things will still be there too.
|
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-12-08 19:55:14 +00:00
|
|
|
Two ways to update the package descriptions:
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-12-08 19:55:14 +00:00
|
|
|
brew update
|
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-10-09 03:25:49 +01:00
|
|
|
brew uninstall wget
|
2009-09-02 14:41:36 +01:00
|
|
|
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
|
|
|
|
2009-10-09 03:25:49 +01:00
|
|
|
Two ways to search for a package to install:
|
2009-09-02 14:41:36 +01:00
|
|
|
|
2009-10-09 03:25:49 +01:00
|
|
|
brew search
|
2009-07-22 02:38:08 +01:00
|
|
|
ls /usr/local/Library/Formula/
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-10-09 03:25:49 +01:00
|
|
|
Two ways to see what is already installed:
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-10-09 03:25:49 +01:00
|
|
|
brew list
|
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-06-28 16:41:28 +01:00
|
|
|
|
2009-07-22 02:38:08 +01:00
|
|
|
Contributing New Formulae
|
|
|
|
=========================
|
2009-12-08 19:55:14 +00:00
|
|
|
Create a new formula thusly:
|
2009-06-18 10:32:53 +01:00
|
|
|
|
2009-10-15 09:09:01 +01:00
|
|
|
brew create http://example.com/foo-1.2.1.tar.bz2
|
2009-06-26 12:59:19 +01:00
|
|
|
|
2009-12-08 19:55:14 +00:00
|
|
|
Homebrew automatically opens Library/Formula/foo.rb in your $EDITOR. You can
|
2009-12-05 13:33:22 +00:00
|
|
|
now install it:
|
2009-06-26 12:59:19 +01:00
|
|
|
|
2009-12-08 19:55:14 +00:00
|
|
|
brew install foo
|
2009-10-15 09:09:01 +01:00
|
|
|
|
2009-12-08 19:55:14 +00:00
|
|
|
The [wiki][] has more help and information.
|
2009-10-15 09:09:01 +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
|
2009-10-09 03:25:49 +01:00
|
|
|
confirm. Individual formulae are licensed according to their authors' wishes.
|
2009-08-31 16:01:36 +01:00
|
|
|
|
|
|
|
|
2009-12-05 13:33:22 +00:00
|
|
|
The Wiki
|
|
|
|
========
|
2009-12-08 19:55:14 +00:00
|
|
|
The [wiki][] probably has the answers to any other questions you may have.
|
2009-10-15 09:09:01 +01:00
|
|
|
|
2009-12-05 13:33:22 +00:00
|
|
|
[wiki]:http://wiki.github.com/mxcl/homebrew
|