Get AI summaries of any video or article — Sign up free
Homebrew Tutorial: Simplify Software Installation on Mac Using This Package Manager thumbnail

Homebrew Tutorial: Simplify Software Installation on Mac Using This Package Manager

Corey Schafer·
5 min read

Based on Corey Schafer's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Install Xcode command-line tools first using `xcode-select --install`, then install Homebrew using the official Ruby script from Homebrew’s website.

Briefing

Homebrew turns macOS software installation into a fast, command-line workflow—installing both developer tools and full macOS apps with consistent commands. After setting up required Xcode command-line tools, installation is done via a single Ruby script from Homebrew’s website, and success is verified with basic commands like `brew help`. Once installed, Homebrew becomes the central way to search, install, inspect, update, and remove packages without manually downloading installers.

Package discovery starts with `brew search`, which can list thousands of available formulas and casks. Results can be narrowed by keyword (for example, searching for “postgress” leads to a likely match such as `postgresql`/`postgresql`-style formula naming), and output is split into two categories: formulas for command-line software and casks for macOS-native applications. The same catalog is also accessible in a browser, where each package includes a short description and more detailed pages.

Installing a command-line tool is straightforward: `brew install <package>`. The tutorial demonstrates this with `tree`, which initially fails with “command not found” until installed. After installation, the `tree` command works from the terminal, and the directory structure output can be generated for a chosen project folder (using `cd` to a target directory first). To understand where software lands, `which tree` reveals a path under `/usr/local/bin`, which is a symbolic link; the real installation is in the `/usr/local/.../Cellar`-style location. For deeper visibility, `brew info <package>` provides metadata such as description, install location, and timing. When a package is not installed, `brew info` highlights dependencies and uses status indicators (red X vs green check) to show what’s missing.

Homebrew also manages alternative versions of common Unix tools. Installing GNU variants often uses a `g` prefix rather than overwriting macOS’s BSD defaults. The example is `grep`: macOS’s default is “BSD grep,” while Homebrew’s `grep` formula installs “GNU grep” as `ggrep` (and similarly `g`-prefixed binaries). The caveat explains how to adjust PATH (via shell profile files) if someone wants to use the unprefixed command names.

Maintenance follows familiar Linux-style commands: `brew list` shows installed packages, `brew update` fetches new package metadata, `brew outdated` lists what can be upgraded, and `brew upgrade` performs updates. Old versions can be removed with `brew cleanup`. If problems arise, `brew doctor` runs a self-diagnosis and prints warnings intended to help Homebrew maintainers.

For macOS apps, Homebrew uses casks: `brew cask install <app>`. Installing Firefox via `brew cask install Firefox` moves the app into the Applications folder and can trigger the standard first-launch security prompt. Cask search and inspection mirror formula commands (`brew search`, `brew cask info`, and `brew cask home`).

Beyond the core repository, additional software sources are added with `brew tap`. The tutorial shows this with the Heroku CLI: searching initially returns no results until the Heroku Forge brew repository is tapped, after which `brew install Heroku` works. Finally, Homebrew can be removed using an official uninstall script, which removes Homebrew itself and its installed packages (with cask apps like Firefox potentially remaining). The result is a repeatable setup process that can save hours when provisioning new development machines.

Cornell Notes

Homebrew provides a command-line way to install and manage software on macOS, including both command-line tools (formulas) and native macOS apps (casks). After installing required Xcode command-line tools, Homebrew is installed via a Ruby script and verified with commands like `brew help`. Users can search (`brew search`), install (`brew install` / `brew cask install`), inspect (`brew info` / `brew cask info`), and uninstall (`brew uninstall`). Homebrew maintenance uses familiar commands: `brew update`, `brew outdated`, `brew upgrade`, and `brew cleanup`, while `brew doctor` helps diagnose issues. GNU tool variants installed through Homebrew typically use a `g` prefix (e.g., `ggrep`) rather than overwriting macOS BSD defaults.

How does someone distinguish between Homebrew “formulas” and “casks,” and why does that matter for installation?

Homebrew splits installable items into two main categories. Formulas are typically command-line software installed with `brew install`, while casks are an extension used for macOS-native applications installed with `brew cask install`. This matters because the command you run changes: `brew install tree` installs a terminal command, while `brew cask install Firefox` installs a full app and places it into the Applications folder.

What commands can verify that Homebrew is installed correctly and that a package installation worked?

After running the official install script, success is checked by running `brew help`—if it returns available `brew` commands rather than an error, Homebrew is working. For a specific tool, installation is validated by running the command itself; for example, `tree` initially fails with “command not found” until `brew install tree` completes, after which `tree` produces directory-structure output.

Where do Homebrew-installed command-line tools end up, and how can a user confirm the path?

Running `which <command>` shows a path under `/usr/local/bin`, but that location is often a symbolic link. Using `ls -la` on the symlink reveals the target directory (the real installation location under the Homebrew-managed directory tree, described in the transcript as `/usr/local` with a seller/Cellar-style path). This helps users understand how the terminal command resolves to the actual installed files.

How does Homebrew handle GNU versions of tools that overlap with macOS BSD tools?

Homebrew’s GNU variants generally do not overwrite macOS’s BSD versions. Instead, the installed binaries use a `g` prefix. The transcript’s example is `grep`: macOS shows “BSD grep,” while `brew info grep` indicates “G grep” (GNU grep). The caveat notes that commands are installed with a prefix, so the GNU command becomes `ggrep`. The macOS BSD `grep` remains available unless PATH is adjusted to prefer the GNU bin directory.

What is the typical workflow for updating and upgrading packages in Homebrew?

The maintenance sequence mirrors Linux package managers. `brew update` fetches the newest package metadata. `brew outdated` lists packages with newer versions available. `brew upgrade` updates those outdated packages. Over time, older versions can accumulate, and `brew cleanup` removes older versions. Installed packages can be listed with `brew list`.

How can someone install software from a third-party repository like Heroku’s CLI?

If `brew search` returns “no formula or cask found,” the missing step is usually tapping the repository. The transcript shows this for Heroku: searching initially finds nothing, then `brew tap Heroku Forge brew` is run. After tapping, `brew search Heroku` returns results (e.g., `Heroku` and `Heroku node`), and `brew install Heroku` installs the Heroku CLI.

Review Questions

  1. What are the practical differences between installing with `brew install` and `brew cask install`, and how would you choose which one to use?
  2. Why might `ggrep` exist alongside macOS’s `grep`, and what does Homebrew’s PATH caveat imply?
  3. Which sequence of commands would you run to identify and then upgrade outdated Homebrew packages?

Key Points

  1. 1

    Install Xcode command-line tools first using `xcode-select --install`, then install Homebrew using the official Ruby script from Homebrew’s website.

  2. 2

    Use `brew search` to find available formulas and casks; narrow results by keyword when the catalog is large.

  3. 3

    Install command-line tools with `brew install <formula>` and macOS apps with `brew cask install <app>` (e.g., Firefox).

  4. 4

    Use `brew info <package>` to check install details and dependencies; missing dependencies are flagged with red X indicators.

  5. 5

    Homebrew updates follow a Linux-style flow: `brew update`, `brew outdated`, then `brew upgrade`, with `brew cleanup` to remove older versions.

  6. 6

    GNU replacements for common tools usually use a `g` prefix (like `ggrep`) rather than overwriting macOS BSD defaults.

  7. 7

    Add third-party sources with `brew tap <repo>` when `brew search` returns no results, as shown with the Heroku CLI.

Highlights

Homebrew’s formulas vs casks split determines whether software is installed as a terminal tool (`brew install`) or as a macOS application (`brew cask install`).
`brew info` is a practical diagnostic tool: it reports install location and timing, and for uninstalled packages it lists dependencies with red X/green check status.
GNU tool installs typically avoid overwriting macOS BSD tools by using `g`-prefixed binaries (e.g., `ggrep`), with PATH changes as the opt-in mechanism.
Maintenance uses familiar commands—`brew update`, `brew outdated`, `brew upgrade`—and `brew cleanup` helps prevent old versions from piling up.
Third-party software often requires `brew tap` before `brew search` will find installable formulas or casks (demonstrated with Heroku).

Topics

  • Homebrew Installation
  • Package Search
  • Formulas vs Casks
  • GNU Tools
  • Updating and Cleanup

Mentioned