# Formula Cookbook Making a formula is easy. Just `brew create URL` and then `brew install $FORMULA` (perhaps with `--debug --verbose`). Basically, a formula is a Ruby file. You can place it anywhere you want (local or remote) and install it by pointing to the file or URL. We want your formula to be awesome, and the cookbook will tell you how. ## API documentation Some people find it easier to jump straight into API documentation rather than a walkthrough. If you're one of these check out the [Formula API](http://www.rubydoc.info/github/Homebrew/homebrew/master/Formula) which shows all the stuff you can use in a Homebrew Formula. ## Terminology - Homebrew speak
Formula | The package definition | /usr/local/Library/Formula/foo.rb |
---|---|---|
Keg | The installation prefix of a Formula | /usr/local/Cellar/foo/0.1 |
opt prefix | A symlink to the active version of a keg | /usr/local/opt/foo |
Cellar | All kegs are installed here | /usr/local/Cellar |
Tap | An optional repository (git) of Formulae | /usr/local/Library/Taps |
Bottle | Pre-built (binary) Keg that can be unpacked | qt-4.8.4.mountain_lion.bottle.1.tar.gz |
Value of :using |
Corresponds To |
---|---|
:bzr |
BazaarDownloadStrategy |
:curl |
CurlDownloadStrategy |
:cvs |
CVSDownloadStrategy |
:git |
GitDownloadStrategy |
:hg |
MercurialDownloadStrategy |
:nounzip |
NoUnzipCurlDownloadStrategy |
:post |
CurlPostDownloadStrategy |
:svn |
SubversionDownloadStrategy |
Name | Default | Example |
---|---|---|
HOMEBREW_PREFIX |
/usr/local |
|
prefix |
#{HOMEBREW_PREFIX}/Cellar/#{name}/#{version} |
/usr/local/Cellar/foo/0.1 |
opt_prefix |
#{HOMEBREW_PREFIX}/opt/#{name} |
/usr/local/opt/foo |
bin |
#{prefix}/bin |
/usr/local/Cellar/foo/0.1/bin |
doc |
#{prefix}/share/doc/foo |
/usr/local/Cellar/foo/0.1/share/doc/foo |
include |
#{prefix}/include |
/usr/local/Cellar/foo/0.1/include |
info |
#{prefix}/share/info |
/usr/local/Cellar/foo/0.1/share/info |
lib |
#{prefix}/lib |
/usr/local/Cellar/foo/0.1/lib |
libexec |
#{prefix}/libexec |
/usr/local/Cellar/foo/0.1/libexec |
man |
#{prefix}/share/man |
/usr/local/Cellar/foo/0.1/share/man |
man[1-8] |
#{prefix}/share/man/man[1-8] |
/usr/local/Cellar/foo/0.1/share/man/man[1-8] |
sbin |
#{prefix}/sbin |
/usr/local/Cellar/foo/0.1/sbin |
share |
#{prefix}/share |
/usr/local/Cellar/foo/0.1/share |
pkgshare |
#{prefix}/share/foo |
/usr/local/Cellar/foo/0.1/share/foo |
etc |
#{HOMEBREW_PREFIX}/etc |
/usr/local/etc |
var |
#{HOMEBREW_PREFIX}/var |
/usr/local/var |
buildpath |
A temporary dir somewhere on your system | /private/tmp/[formula-name]-0q2b/[formula-name] |