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.