Homebrew

2023-05-19·
Haobin Tan
Haobin Tan
· 1 min read

Installation

Paste that in a macOS Terminal or Linux shell prompt.

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

Test whether the installation is successful by typing

brew help

Basic Usages

Search for package

brew search <package>

E.g.:

brew search postgres

截屏2023-05-20 00.10.23

There are two types of results

  • Foumlae: Command-line software
  • Casks: An extension of Homebrew that allows us to install MacOS native applications (e.g., Google Chrome)
We can also search in browser: Homebrew Formular.

Install packages

brew install <package>

E.g.:

brew install tree

Homebrew will install tree in /usr/local/bin/ (we can verify that by typing which tree).

If we want to get more information about an (installed) package, we can use

brew info <package>

Install packages

brew uninstall <package>

List installed packages

brew list

Updating packages

Fetch the newest version of all the packages:

brew update 

View the outdated packages:

brew outdated 

Update/Upgrade outdated packages:

brew upgrade 

Remove older versions of packages:

brew cleanup

Self-diagnosis

brew doctor

Install Mac applications

brew install --cask <package>

To see more information about the package (if you are unsure):

brew info --cask <package>

To visit the homepage of the package:

brew home --cask <package>

Reference