Brew Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(39 intermediate revisions by the same user not shown)
Line 2: Line 2:


* [[Brew#Subjects|brew]]
* [[Brew#Subjects|brew]]
* [[Brew_Operations#Overview|brew Operations]]


=Overview=
=Overview=
Line 9: Line 10:
=Formula=
=Formula=


A formula is a package definition written in Ruby. Homebrew comes with a good amount of existing formulae, and they are stored as Ruby files in the default [[#Tap|tap]] named "homebrew": /usr/local/Homebrew/Library/Taps/'''homebrew'''/homebrew-core/Formula/<''package-name''>.rb.  
A formula is a package definition written in Ruby. Conceptually, this is the term for "program managed by brew" (also see [[#Cask|cask]] below). Homebrew comes with a good amount of existing formulae, and they are stored as Ruby files in the default [[#Tap|tap]] named "homebrew/core": /usr/local/Homebrew/Library/Taps/'''homebrew/homebrew-core'''/Formula/<''package-name''>.rb. The directory where a specific formula is located can be displayed with:
 
[[Brew_Operations#formula|brew formula]] <''formula-name''>


The formulae that have already been applied to the system can be listed with:
The formulae that have already been applied to the system can be listed with:


  [[Brew_Operations#list|brew list]]
  [[Brew_Operations#list|brew list]]
An application that has never been installed on the system can be installed with:
[[Brew_Operations#install|brew install]] <''formula-name''>
and it can be updated with:
[[Brew_Operations#update|brew update]] <''formula-name''>


==Common Formulate==
==Common Formulate==
Line 23: Line 34:
==Custom Formulae==
==Custom Formulae==


New formulae can be can be created. Instructions are available here: https://docs.brew.sh/Formula-Cookbook. The sequence is:
New formulae can be created. Instructions are available here: https://docs.brew.sh/Formula-Cookbook. The sequence is:


  brew create <''URL''>  
  brew create <''URL''>  
Line 36: Line 47:


Formula API: http://www.rubydoc.info/github/Homebrew/brew/master/Formula
Formula API: http://www.rubydoc.info/github/Homebrew/brew/master/Formula
=Tap=
A ''tap'' is a Git repository of [[#Formula|formulae]] and other commands.


=Keg=
=Keg=
Line 48: Line 55:


  /usr/local/Cellar/foo/0.1
  /usr/local/Cellar/foo/0.1
=Tap=
A '''tap''' is a Git repository of [[#Formula|formulae]] or [[#Cask|casks]].
The list of all taps available on the system is provided by:
[[Brew_Operations#tap|brew tap]]
A new repository [[Brew_Operations#Add_a_New_Tap|can be added]].
By default, the following taps are available:
* homebrew/core
* homebrew/cask


=Cellar=
=Cellar=
Line 53: Line 74:
The directory where all [[#Keg|kegs]] are stored:
The directory where all [[#Keg|kegs]] are stored:


<font size=-2>
  /usr/local/Cellar
  /usr/local/Cellar
</font>
Depending on the <code>brew</code> instance, the location may differ. The actual value can be obtained with:
<syntaxhighlight lang='bash'>
brew --cellar
</syntaxhighlight>
The command yields the same result as <code>$(brew --prefix)/Cellar</code>.


=Bottle=
=Bottle=


=Cask=
=<span id='Homebrew-Cask'></span>Cask=
{{External|https://caskroom.github.io}}
{{External|https://github.com/caskroom/homebrew-cask/blob/master/USAGE.md}}
 
A '''cask''' is application distributed in binary form, in some cases also including a graphical UI. Examples: google-chrome, docker, corretto11. Brew commands allow for a <code>--cask</code> command line option that changes their semantics to apply to casks, instead of formulae.  The difference between formulae and casks is that in case of formulae, source code that will be compiled. Casks are pre-compiled.
 
<span id='Caskroom'></span>The files associated with a cask are stored in the "Caskroom" <code>/usr/local/Caskroom</code>.
 
<font color=darkgray>
To install Homebrew Cask itself:
 
[[Brew_Operations#Install_Homebrew_Cask|brew tap caskroom/cask]]
 
An example of installing Google Chrome with cask:


<syntaxhighlight lang='bash'>
brew cask install google-chrome
==> Satisfying dependencies
==> Downloading https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg
######################################################################## 100.0%
==> Verifying checksum for Cask google-chrome
==> Installing Cask google-chrome
==> Moving App 'Google Chrome.app' to '/Applications/Google Chrome.app'.
🍺  google-chrome was successfully installed!
</syntaxhighlight>
</font>


=User Space vs. System Space=
=User Space vs. System Space=
=Install Path=
==<tt>brew --prefix</tt>==
Displays the brew install path.
<code>--prefix</code> can be used with specific formulas:
<syntaxhighlight lang='bash'>
brew --prefix python
</syntaxhighlight>

Latest revision as of 23:24, 2 November 2023

Internal

Overview

Homebrew is a package management system for Mac. All applications installed with Homebrew are linked from /usr/local/bin which usually takes precedence over /usr/bin:/bin:/usr/sbin:/sbin, where system utilities are installed. For example, if bash is installed with Homebrew, it'll be usually the newest one and take precedence over the one that comes with the system in /bin/bash.

Formula

A formula is a package definition written in Ruby. Conceptually, this is the term for "program managed by brew" (also see cask below). Homebrew comes with a good amount of existing formulae, and they are stored as Ruby files in the default tap named "homebrew/core": /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/<package-name>.rb. The directory where a specific formula is located can be displayed with:

brew formula <formula-name>

The formulae that have already been applied to the system can be listed with:

brew list

An application that has never been installed on the system can be installed with:

brew install <formula-name>

and it can be updated with:

brew update <formula-name>

Common Formulate

bash

/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/bash.rb

Custom Formulae

New formulae can be created. Instructions are available here: https://docs.brew.sh/Formula-Cookbook. The sequence is:

brew create <URL> 

where <URL> is a zip or tar file, installed with

brew install <formula>

and debugged with:

brew install --debug --verbose <formula>

Formula API: http://www.rubydoc.info/github/Homebrew/brew/master/Formula

Keg

A keg is the installation prefix of a formula. The corresponding directories are stored in cellar.

Example:

/usr/local/Cellar/foo/0.1

Tap

A tap is a Git repository of formulae or casks.

The list of all taps available on the system is provided by:

brew tap

A new repository can be added.

By default, the following taps are available:

  • homebrew/core
  • homebrew/cask

Cellar

The directory where all kegs are stored:

/usr/local/Cellar

Depending on the brew instance, the location may differ. The actual value can be obtained with:

brew --cellar

The command yields the same result as $(brew --prefix)/Cellar.

Bottle

Cask

https://caskroom.github.io
https://github.com/caskroom/homebrew-cask/blob/master/USAGE.md

A cask is application distributed in binary form, in some cases also including a graphical UI. Examples: google-chrome, docker, corretto11. Brew commands allow for a --cask command line option that changes their semantics to apply to casks, instead of formulae. The difference between formulae and casks is that in case of formulae, source code that will be compiled. Casks are pre-compiled.

The files associated with a cask are stored in the "Caskroom" /usr/local/Caskroom.

To install Homebrew Cask itself:

brew tap caskroom/cask

An example of installing Google Chrome with cask:

brew cask install google-chrome
==> Satisfying dependencies
==> Downloading https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg
######################################################################## 100.0%
==> Verifying checksum for Cask google-chrome
==> Installing Cask google-chrome
==> Moving App 'Google Chrome.app' to '/Applications/Google Chrome.app'.
🍺  google-chrome was successfully installed!

User Space vs. System Space

Install Path

brew --prefix

Displays the brew install path.

--prefix can be used with specific formulas:

brew --prefix python