Important Homebrew Commands

Homebrew is a free and open-source package management system that makes it easier to install software on Apple MacOS and Linux. It is easy to use and integrates well into the Command-Line. It was written by Max Howell in 2009. Likewise, it is one of the most popular projects on GitHub. Furthermore, it is written in the Ruby programming language. This blog post will list out some important Homebrew commands for installing and maintaining packages using the command line.

Installing Homebrew

According to the instructions on its official webpage, paste the below command in the macOS terminal. It is recommended to run this command from /usr/local location.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Once you type this command, it will install the Homebrew on your machine.

local % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew

Once it is installed, you can verify by using brew command.

brew
Example usage:
  brew search [TEXT|/REGEX/]
  brew info [FORMULA...]
  brew install FORMULA...

Important Homebrew commands

Let’s see some important Homebrew commands that can be used for installing packages. Please check the official brew website for a list of available packages.

brew is the core command for the Homebrew project and deals with command-line software.

  • Global commands
CommandsFunction
brew updateUpdates the brew package and cask package
brew listLists all the installed package using brew
  • General Commands
CommandsFunction
brew install sparkInstalls a Package Spark
brew upgrade sparkUpgrades the Package to the latest version available
brew uninstall sparkUninstalls the package
brew list --versions sparkLists down the version that you have
brew switch spark 2.4.0Switches to certain versions
brew info sparkLists the package versions and other details
brew cleanup sparkCleans up older versions of Spark
  • Cask Commands

brew cask is an extension to brew that allows the management of graphical applications through the cask project.

CommandsFunction
brew cask install jupyterlabInstalls the Jupyter Lab notebook application
brew cask listLists all the applications installed using cask