-
Notifications
You must be signed in to change notification settings - Fork 0
Bottles
Bottles are Homebrew's binary packages. They are produced by installing a formula with brew install --build-bottle foo
and then bottling it with brew bottle foo
. This outputs the bottle DSL which should be inserted into the formula file.
If a bottle is available and usable it will be downloaded and poured automatically when you brew install <formula>
. If you wish to disable this you can do it by specifying --build-from-source
or set export HOMEBREW_BUILD_FROM_SOURCE=1
environment variable.
Bottles will not be used if the user requests it (see above), if the formula requests it (with pour_bottle?
), if any options are specified on installation (bottles are all compiled with default options), if the bottle is not up to date (e.g. lacking a checksum) or the bottle's cellar
is not :any
or equal to the current HOMEBREW_CELLAR
.
Bottles can also be cached locally and installed by path e.g. brew install /Library/Caches/Homebrew/qt-4.8.4.mountain_lion.bottle.1.tar.gz
.
Bottles are currently created manually for a few formulae by Homebrew maintainers (mostly @mikemcquaid) using personal or virtual machines. As the result of our successful Kickstarter we will be creating them automatically for all formulae and trying to integrate them more widely into Homebrew.
Bottles are simple gzipped tarballs of compiled binaries. Any metadata is stored in a formula's bottle DSL and in the bottle filename (i.e. MacOS version, revision).
Bottles have a DSL to be used in formulae which is contained in the bottle do ... end
block.
A simple (and typical) example:
bottle do
sha1 'd3d13fe6f42416765207503a946db01378131d7b' => :mountain_lion
sha1 'cdc48e79de2dee796bb4ba1ad987f6b35ce1c1ee' => :lion
sha1 'a19b544c8c645d7daad1d39a070a0eb86dfe9b9c' => :snow_leopard
end
A full example:
bottle do
root_url 'http://mikemcquaid.com'
prefix '/opt/homebrew'
cellar '/opt/homebrew/Cellar'
revision 4
sha1 'd3d13fe6f42416765207503a946db01378131d7b' => :mountain_lion
sha1 'cdc48e79de2dee796bb4ba1ad987f6b35ce1c1ee' => :lion
sha1 'a19b544c8c645d7daad1d39a070a0eb86dfe9b9c' => :snow_leopard
sha1 '583dc9d98604c56983e17d66cfca2076fc56312b' => :snow_leopard_32
sha1 '2ef5f57afae319a3e7618d5723059eae568276fa' => :leopard
end
Optionally contains the URL root used to calculate bottle URLs.
By default this is omitted and the Homebrew default bottle URL root is used. This may be useful for taps which wish to provide bottles for their formulae or to cater for a non-default HOMEBREW_CELLAR
.
Optionally contains the value of HOMEBREW_CELLAR
in which the bottles were built.
Most compiled software contains references to its compiled location so cannot be simply relocated anywhere on disk. If this value is :any
this means that the bottle can be safely installed in any Cellar as it did not contain any references to its installation Cellar. This can be omitted if a bottle is compiled (as all default Homebrew ones are) for the default HOMEBREW_CELLAR
of /usr/local/Cellar
Optionally contains the value of HOMEBREW_PREFIX
in which the bottles were built.
See description of cellar
. When cellar
is :any
prefix should be omitted.
Optionally contains the revision of the bottle.
Sometimes bottles may need be updated without bumping the version of the formula e.g. a new patch was applied. In that case the revision will have a value of 1 or more.
Contains the SHA-1 of bottle for a particular version of OS X.
Additionally there is a method available in the formula DSL.
Optionally returns a boolean to decide whether a bottle should be used for this formula.
For example a bottle may break if another formula has been compiled with non-default options so this method could check for that case and return false
.
Most bottle features have been (and planned improvements will be) implemented by @mikemcquaid. Contact him directly with questions or to add to this list.
- Use the hardware from successful Kickstarter to build more bottles
- Write a basic Bundler clone that allows vendoring local bottles