Skip to main content

Introduction to Homebrew

ยท 3 min read

"The most popular command-line package manager for macOS."

Still hunting down installers one by one on official websites? With Homebrew, one command handles everything โ€” install, update, uninstall โ€” all managed in one place. Say goodbye to manual downloads.

Homebrew is a package manager for macOS and Linux. Its core value in one sentence: manage all your software from the command line, unified.


Installing Homebrewโ€‹

In Chinaโ€‹

Due to network restrictions, using a domestic mirror is recommended: source

/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"

Outside Chinaโ€‹

Use the official script: source

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

Core Concepts: formula and caskโ€‹

Before using Homebrew, understand two key concepts:

  • formula: installs command-line tools like git or python โ€” no graphical interface
  • cask: installs GUI apps like Firefox or VS Code

Simple rule: App with an icon โ†’ cask; command-line only โ†’ formula.

Not talking about Gragas from League of Legends ๐Ÿ˜‚


Installing Softwareโ€‹

Install a command-line tool (formula), e.g. git:

brew install git

Install a GUI app (cask), e.g. Firefox:

brew install --cask firefox

Updating Softwareโ€‹

Before upgrading, refresh Homebrew's package list to get the latest versions:

brew update # refresh the package list (like refreshing the App Store)

Then upgrade a specific package, e.g. Python:

brew upgrade python

Note: brew update updates Homebrew's own package index; brew upgrade actually upgrades the software. They are different.


Pinning a Versionโ€‹

Sometimes you don't want a package to be auto-upgraded โ€” for example, your project depends on a specific version of Python and upgrading would break things. Use pin to lock the version:

brew pin python # lock python, prevent auto-upgrade

List pinned packages:

brew list --pinned

Unpin to allow upgrades again:

brew unpin python

Uninstalling Softwareโ€‹

Uninstall a command-line tool:

brew uninstall node

Uninstall a GUI app:

brew uninstall --cask firefox

Uninstall Homebrew itself:

/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/uninstall.sh)"

Summaryโ€‹

OperationCommand
Install CLI toolbrew install <name>
Install GUI appbrew install --cask <name>
Refresh package listbrew update
Upgrade softwarebrew upgrade <name>
Pin versionbrew pin <name>
List pinnedbrew list --pinned
Unpin versionbrew unpin <name>
Uninstallbrew uninstall <name>

These commands cover the vast majority of everyday Homebrew usage. In my opinion, Homebrew is an essential tool for every Mac โ€” it's simply too convenient to go without.