Brainstorm's snippets (1/265)

  Homebrew Cheatsheet

Homebrew cheatsheet (outdated: some commands - notably switch - have been removed)


brew install git Install a package
brew uninstall git Remove/Uninstall a package
brew upgrade git Upgrade a package
brew unlink git Unlink
brew link git Link
brew switch git 2.5.0 Change versions
brew list --versions git See what versions you have

More package commands

brew info git List versions, caveats, etc
brew cleanup git Remove old versions
brew edit git Edit this formula
brew cat git Print this formula
brew home git Open homepage
brew search git Search for formulas

Global commands

brew update Update brew and cask
brew list List installed
brew outdated What’s due for upgrades?
brew doctor Diagnose brew issues

Brew Cask commands

brew cask install firefox Install the Firefox browser
brew cask list List installed applications

(*) Cask commands are used for interacting with graphical applications.


See also:

Uninstalling homebrew


ruby -e "$(curl -fsSL"


cd /tmp
cd `brew --prefix`
rm -rf Cellar
brew prune
rm `git ls-files`
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions
rm -rf .git
rm -rf ~/Library/Caches/Homebrew

Homebrew Multi User Setup


  • Create a group brew and add Stan
  • brew doctor (Allen checks if he installed brew correctly)
  • sudo chgrp -R brew $(brew --prefix)/* (Change the group of homebrew installation directory)
  • sudo chmod -R g+w $(brew --prefix)/* (Allow group members to write inside this directory)
  • brew doctor (Stan checks if he can use homebrew)
  • We are done!

Example: How to install a specific version of python3 on OS X

Since switch has been removed from brew, we proceed as follows ...

Install the desided version:

brew install python@3.8

List available versions:

brew list | grep python


Change versions:

brew unlink python@3.8
brew unlink python@3.9
brew link --overwrite python@3.8


python3 --version

    Python 3.8.7