What is the difference between brew install XXX and brew cask install XXX

Quoting from official docs:

Cask

https://github.com/Homebrew/homebrew-cask

Homebrew Cask extends Homebrew and brings its elegance, simplicity, and speed to the installation and management of GUI macOS applications such as Atom and Google Chrome.

Cellar

https://docs.brew.sh/Formula-Cookbook

Homebrew installs to the Cellar and then symlinks some of the installation into /usr/local so that other programs can see what’s going on.

Tap

https://docs.brew.sh/Taps

Taps (Third-Party Repositories)

brew tap adds more repositories to the list of formulae that brew tracks, updates, and installs from. By default, tap assumes that the repositories come from GitHub, but the command isn’t limited to any one location.


Homebrew-Cask is an extension to Homebrew to install GUI applications such as Google Chrome or Atom. It started independently but its maintainers now work closely with Homebrew’s core team.

Homebrew calls its package definition files “formulae” (British plural for “formula”). Homebrew-Cask calls them “casks”. A cask, just like a formula, is a file written in a Ruby-based DSL that describes how to install something.

The Cellar is where Homebrew installs things. Its default path is /usr/local/Cellar (/opt/homebrew/Cellar on Apple Silicon). It then add symlinks from standard locations to it.

For example, when you type brew install git:

  1. Homebrew installs it under /usr/local/Cellar/git/<version>/, with the git binary in /usr/local/Cellar/git/<version>/bin/git
  2. It adds a symlink from /usr/local/bin/git to that binary

This allows Homebrew to keep track of what’s installed by Homebrew versus software installed by other means.

A tap is a source of formulae. The default is homebrew/core but you can add more of them. The simplest way to create a formula for your own software is to create a GitHub repository called homebrew-<something>; put your formula file in it; then type brew tap <username>/<something> to add this new source of formulae to your Homebrew installation and so get access to all its formulae.

Some companies have internal Homebrew taps for their own utilities. There are a lot of public taps like atlassian/tap for Atlassian software, or ska-sa/tap for radio astronomy. Homebrew itself used to have additional taps like homebrew/science but they deprecated them and imported the formulæ in homebrew/core.


I personally differentiate brew & cask just based on 1 of the main (if not the only main) differences, of graphical GUI applications being managed by cask rather than just brew. (There are other differences too which I don't know as much about).

Below adapted from 'Graham Miln' on apple.stackexchange:

Homebrew

brew is the core command for the Homebrew project.

The missing package manager for OS X

Homebrew installs the stuff you need that Apple didn’t.

Homebrew typically deals with command line software (not graphical GUI applications). Most of the software is distributed under an open source licence.

Cask

brew cask is an extension to brew that allows management of graphical GUI applications.

Homebrew Cask extends Homebrew and brings its elegance, simplicity, and speed to OS X applications and large binaries alike.

Cask deals with a mixture of software and licences.

Cask offers a way to command line manage the installation of graphical GUI applications.

Licensing

Availability through brew or cask does not imply any specific licence.

Tags:

Homebrew