Homebrew Tutorial: Simplify Software Installation on Mac Using This Package Manager
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.
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?
What commands can verify that Homebrew is installed correctly and that a package installation worked?
Where do Homebrew-installed command-line tools end up, and how can a user confirm the path?
How does Homebrew handle GNU versions of tools that overlap with macOS BSD tools?
What is the typical workflow for updating and upgrading packages in Homebrew?
How can someone install software from a third-party repository like Heroku’s CLI?
Review Questions
- What are the practical differences between installing with `brew install` and `brew cask install`, and how would you choose which one to use?
- Why might `ggrep` exist alongside macOS’s `grep`, and what does Homebrew’s PATH caveat imply?
- Which sequence of commands would you run to identify and then upgrade outdated Homebrew packages?
Key Points
- 1
Install Xcode command-line tools first using `xcode-select --install`, then install Homebrew using the official Ruby script from Homebrew’s website.
- 2
Use `brew search` to find available formulas and casks; narrow results by keyword when the catalog is large.
- 3
Install command-line tools with `brew install <formula>` and macOS apps with `brew cask install <app>` (e.g., Firefox).
- 4
Use `brew info <package>` to check install details and dependencies; missing dependencies are flagged with red X indicators.
- 5
Homebrew updates follow a Linux-style flow: `brew update`, `brew outdated`, then `brew upgrade`, with `brew cleanup` to remove older versions.
- 6
GNU replacements for common tools usually use a `g` prefix (like `ggrep`) rather than overwriting macOS BSD defaults.
- 7
Add third-party sources with `brew tap <repo>` when `brew search` returns no results, as shown with the Heroku CLI.