2009-05-21 00:04:11 +01:00
|
|
|
Homebrew
|
|
|
|
========
|
2009-07-24 15:10:01 +01:00
|
|
|
Homebrew's purpose is basically the same as MacPorts or Fink, ie. to let you
|
|
|
|
easily install 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-07-22 02:38:08 +01:00
|
|
|
1. Zeroconf installation
|
|
|
|
Copy the contents of this directory to /usr/local. Homebrew is now ready
|
|
|
|
for use.
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-07-22 02:38:08 +01:00
|
|
|
2. Or… install anywhere!
|
|
|
|
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.
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-07-22 02:38:08 +01:00
|
|
|
3. The GoboLinux approach
|
|
|
|
Packages are installed to their own prefix (eg. /usr/local/Cellar/wget) and
|
|
|
|
then symlinked into the Homebrew prefix (eg. /usr/local).
|
|
|
|
|
|
|
|
This way the filesystem is the package database. As is often the case with
|
|
|
|
the simplest possible solution, it makes everything else easier and better.
|
|
|
|
|
|
|
|
Eg. You can, if you like, rm -rf to uninstall a package. Or use find to
|
|
|
|
list the package contents. Or du to see its size.
|
|
|
|
|
|
|
|
4. You don't have to sudo
|
2009-07-22 20:27:58 +01:00
|
|
|
It's up to you. We recommend not--see the relevant later section.
|
2009-07-22 02:38:08 +01:00
|
|
|
|
|
|
|
5. Easy package creation
|
|
|
|
Packages are just Ruby scripts. Generate a template with:
|
|
|
|
|
2009-07-22 20:27:58 +01:00
|
|
|
brew mk http://foo.com/tarball-0.8.9.tgz
|
2009-07-22 02:38:08 +01:00
|
|
|
|
|
|
|
Homebrew will automatically open it for you to tweak with TextMate or
|
|
|
|
$EDITOR.
|
|
|
|
|
2009-07-24 15:10:01 +01:00
|
|
|
6. DIY package installation
|
|
|
|
MacPorts doesn't support the beta version? Need an older version? Need
|
|
|
|
custom compile flags? The Homebrew toolchain is carefully segregated so
|
2009-07-28 00:31:21 +01:00
|
|
|
you can build stuff by hand but still end up with package management.
|
2009-07-22 02:38:08 +01:00
|
|
|
|
2009-07-24 15:10:01 +01:00
|
|
|
Just install to the Cellar and then call brew ln to symlink that
|
|
|
|
installation into /usr/local, eg.
|
|
|
|
|
|
|
|
./configure --prefix=/usr/local/Cellar/wget/1.10
|
|
|
|
make install
|
|
|
|
brew ln wget
|
|
|
|
|
|
|
|
This means you can also install multiple versions of the same package and
|
|
|
|
switch on demand.
|
|
|
|
|
|
|
|
7. Optimisation
|
2009-07-22 02:38:08 +01:00
|
|
|
We optimise for Leopard Intel, binaries are stripped, compile flags
|
|
|
|
tweaked. Nobody wants crappy, slow software. Apart from MacPorts and Fink.
|
|
|
|
|
2009-07-24 15:10:01 +01:00
|
|
|
8. Integration with existing OS X technologies
|
2009-07-22 02:38:08 +01:00
|
|
|
Homebrew integrates with Ruby gems, CPAN and Python disttools. These tools
|
|
|
|
exist already and do the job great. We don't reinvent the wheel, we just
|
|
|
|
improve it by making these tools install with more management options.
|
|
|
|
|
2009-07-24 15:10:01 +01:00
|
|
|
9. Complimenting what OS X already has
|
2009-07-22 02:38:08 +01:00
|
|
|
Macports is an autarky. You get a duplicate copy of libz, OpenSSL, Python
|
|
|
|
etc. They do this to support OS X Tiger, etc. more easily. We don't support
|
|
|
|
Tiger, we duplicate nothing. Homebrew compliments OS X, it doesn't seek to
|
|
|
|
operate independently of it.
|
|
|
|
|
2009-07-28 00:31:21 +01:00
|
|
|
A. Fork with Git
|
|
|
|
The package descriptions are all on git, so just fork to add new packages,
|
|
|
|
or add extra remotes to get packages from more exotic maintainers.
|
|
|
|
|
|
|
|
B. Homebrew has a beer theme
|
2009-07-22 02:38:08 +01:00
|
|
|
Beer goggles will help you to evangelise Homebrew more effectively.
|
|
|
|
|
2009-07-28 00:31:21 +01:00
|
|
|
C. Homebrew helps get you chicks
|
2009-07-22 02:38:08 +01:00
|
|
|
There's no conclusive scientific evidence as yet, but I firmly believe it's
|
2009-07-24 15:10:01 +01:00
|
|
|
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
|
|
|
|
and embrace the fresh hoppy taste of Homebrew, but I should point out that it
|
|
|
|
is really new and still under heavy development. Thanks!
|
|
|
|
|
2009-06-04 20:03:53 +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
|
|
|
|
|
|
|
http://developer.apple.com/technology/xcode.html
|
|
|
|
|
2009-07-22 02:38:08 +01:00
|
|
|
Also, a lot of 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 and
|
|
|
|
you email me with a bug report. So uninstall them (or rename their root
|
|
|
|
folders if you don't want to burn bridges).
|
2009-06-05 12:56:28 +01:00
|
|
|
|
2009-07-10 00:37:20 +01:00
|
|
|
http://trac.macports.org/wiki/FAQ#HowdoIremoveoruninstallMacPorts
|
2009-06-05 12:56:28 +01:00
|
|
|
http://www.finkproject.org/faq/usage-fink.php#removing
|
|
|
|
|
2009-05-21 01:20:37 +01:00
|
|
|
Homebrew uses Ruby and some other stuff that is already installed on Leopard.
|
2009-06-26 12:59:19 +01:00
|
|
|
It is self-contained and ready to go. Just copy this directory somewhere.
|
|
|
|
Things work really well if you put it in /usr/local (especially if you are a
|
2009-06-04 20:03:53 +01:00
|
|
|
developer).
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-07-28 00:31:21 +01:00
|
|
|
ISSUE: Currently in order to update you need to clone the git repository. And
|
|
|
|
I'm not exactly sure what the best fix for that is yet.
|
|
|
|
|
2009-07-22 02:38:08 +01:00
|
|
|
If you install to /usr/local 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
|
|
|
|
|
|
|
$ cpan -i MP3::Info
|
|
|
|
|
2009-07-22 02:38:08 +01:00
|
|
|
OS X is designed to minimise sudo use, you only need it for real root level
|
|
|
|
stuff. On OS X you know your /System and /usr are as clean and pure as the day
|
|
|
|
you bought your Mac because you didn't sudo. You can sleep better at night.
|
|
|
|
|
|
|
|
If you are already the kind of guy who installed TextMate by dragging and
|
|
|
|
dropping it to /Applications, then you won't mind if libflac and pngcrush are
|
|
|
|
installed under your user privileges too. Lets face it; Homebrew is not
|
|
|
|
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-07-28 03:58:38 +08:00
|
|
|
$ sudo chown -R `whoami`:staff /usr/local
|
2009-07-22 02:38:08 +01:00
|
|
|
|
|
|
|
I already have a bunch of junk in /usr/local
|
|
|
|
--------------------------------------------
|
|
|
|
Yeah that's typical. See what you've got, mv the local folder somewhere else,
|
|
|
|
mv Homebrew there and then just reinstall that stuff using Homebrew.
|
|
|
|
|
|
|
|
How about mate and gitx and that?
|
|
|
|
---------------------------------
|
|
|
|
They can easily coexist with Homebrew, that's the beauty of the homebrew-way.
|
2009-06-28 16:41:28 +01:00
|
|
|
|
2009-05-21 00:04:11 +01:00
|
|
|
|
|
|
|
Usage
|
|
|
|
=====
|
|
|
|
Install wget:
|
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:
|
|
|
|
cd /usr/local && git pull origin masterbrew [1]
|
2009-05-21 00:04:11 +01:00
|
|
|
|
|
|
|
Delete a package:
|
2009-07-22 02:38:08 +01:00
|
|
|
brew rm wget OR rm -rf /usr/local/Cellar/wget && brew prune
|
2009-05-21 00:04:11 +01:00
|
|
|
|
|
|
|
List all files in a package:
|
2009-07-22 02:38:08 +01:00
|
|
|
brew list wget OR find /usr/local/Cellar/wget
|
2009-05-21 00:04:11 +01:00
|
|
|
|
|
|
|
Search for a package to install:
|
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-07-22 02:38:08 +01:00
|
|
|
ls /usr/local/Cellar/
|
2009-05-21 00:04:11 +01:00
|
|
|
|
|
|
|
Compute installed size of package:
|
2009-07-22 02:38:08 +01:00
|
|
|
brew info wget OR du /usr/local/Cellar/wget
|
2009-06-18 11:13:11 +01:00
|
|
|
|
|
|
|
Show expensive packages:
|
|
|
|
du -md1 /usr/local/Cellar
|
2009-08-04 00:23:01 +08:00
|
|
|
|
|
|
|
View the packages brew has downloaded and cached:
|
|
|
|
ls `brew --cache` OR ls ~/Library/Caches/Homebrew
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-07-22 02:38:08 +01:00
|
|
|
With Homebrew this is all Ruby. If you want to improve the package
|
|
|
|
installation, amend the Ruby script. If you want to improve the brew command
|
|
|
|
amend the Ruby script. If you want to know exactly what is going on, read the
|
|
|
|
Ruby script.
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-07-22 02:38:08 +01:00
|
|
|
[1] You have to install git before you can update the package list, but
|
2009-05-21 12:38:34 +01:00
|
|
|
that's easy:
|
|
|
|
|
|
|
|
brew install git
|
2009-05-21 00:04:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
Why Compile From Source?
|
|
|
|
========================
|
|
|
|
Since we only target Intel Leopard boxes, why not just distribute binaries?
|
2009-05-21 04:33:35 +01:00
|
|
|
Well, I can't afford to :P And compiling from source gives more flexibility.
|
|
|
|
If you want to adapt the system and make it work with binaries; fork away.
|
|
|
|
The bandwidth is on you though :P
|
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-07-28 00:31:21 +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
|
|
|
|
to /usr, so we suggest you adapt the tools to install into Homebrew's prefix:
|
|
|
|
|
|
|
|
http://github.com/mxcl/homebrew/wiki
|
|
|
|
|
|
|
|
|
2009-07-22 02:38:08 +01:00
|
|
|
Contributing New Formulae
|
|
|
|
=========================
|
|
|
|
Homebrew can generate the formula with most stuff pre-done:
|
2009-06-18 10:32:53 +01:00
|
|
|
|
|
|
|
brew mk http://foo.org/foobar-1.2.1.tar.bz2
|
2009-06-26 12:59:19 +01:00
|
|
|
|
2009-07-22 02:38:08 +01:00
|
|
|
You now have /usr/local/Library/Formula/foobar.rb. This may already work.
|
|
|
|
But maybe there are some juicy configure options?
|
2009-06-26 12:59:19 +01:00
|
|
|
|
|
|
|
brew install foobar --help
|
|
|
|
|
|
|
|
Now you know foobar's configure options.
|
|
|
|
|
|
|
|
brew install foobar --interactive
|
2009-06-18 10:32:53 +01:00
|
|
|
|
2009-06-26 12:59:19 +01:00
|
|
|
This opens an interactive bash shell at the extracted tarball. You can now
|
|
|
|
install to the recommended prefix or just read the README and type `exit'.
|
|
|
|
|
|
|
|
Try to install it:
|
|
|
|
|
|
|
|
brew install foobar
|
2009-06-18 10:32:53 +01:00
|
|
|
|
2009-07-22 02:38:08 +01:00
|
|
|
Fork http://github.com/mxcl/homebrew and ask mxcl to pull.
|
2009-06-02 13:39:39 +01:00
|
|
|
|
2009-07-22 20:27:58 +01:00
|
|
|
Useful commands when contributing
|
|
|
|
---------------------------------
|
2009-07-22 02:38:08 +01:00
|
|
|
brew edit # opens Textmate with all of Homebrew as a project
|
|
|
|
brew edit foobar # opens that formula for editing in Textmate
|
|
|
|
brew install foobar --debug # if the build fails, you can fix it
|
2009-07-28 00:31:21 +01:00
|
|
|
brew [something] --verbose # you get a proper Ruby backtrace
|
2009-07-22 02:38:08 +01:00
|
|
|
brew install foobar --interactive # opens a new shell at the extract tarball
|
2009-06-26 12:59:19 +01:00
|
|
|
|
2009-05-21 00:04:11 +01:00
|
|
|
|
2009-06-26 12:59:19 +01:00
|
|
|
TODO
|
2009-07-22 20:27:58 +01:00
|
|
|
====
|
|
|
|
1. Upgrades, yeah still need this
|
|
|
|
2. Install multiple versions of tools, which is very useful for eg. Qt
|
|
|
|
3. Formula revisions, to allow upgrades irrespective of the underlying package
|
2009-06-26 12:59:19 +01:00
|
|
|
|
2009-05-21 00:04:11 +01:00
|
|
|
|
|
|
|
FAQ
|
|
|
|
===
|
|
|
|
Are you excessively interested in beer?
|
|
|
|
---------------------------------------
|
|
|
|
Yes.
|
|
|
|
|
2009-06-04 20:03:53 +01:00
|
|
|
Was Homebrew devised under the influence of alcohol?
|
2009-05-21 00:04:11 +01:00
|
|
|
-----------------------------------------------------
|
2009-06-28 16:41:28 +01:00
|
|
|
Yes.
|