Elena' s AI Blog

Brewing with Homebrew

11 Aug 2025 (updated: 05 Jul 2026) / 13 minutes to read

Elena Daehnhardt


Midjourney 7.0: a program code and a female coder in a red blouse is writing a program, light background, HD


TL;DR:
  • A technical setup guide and command cheat sheet for Homebrew on macOS and Linux. Covers installation, dependency management, Cask usage, and essential packages.

Previous: Part 7 — Anaconda Environments

Introduction: Escaping Dependency Hell

If you are developing software on a Mac, you eventually hit a wall where you need a specific version of Python, Node, or an obscure command-line utility. Manually downloading binaries, resolving missing dependencies, and compiling from source is a massive waste of time.

This is exactly why Homebrew exists. Homebrew is a free, open-source package manager that installs command-line tools and applications on macOS, Linux, and Windows Subsystem for Linux (WSL) without manual dependency resolution.

Instead of navigating complex installation wizards or polluting your system with scattered files, Homebrew installs packages directly to their own directory (/opt/homebrew on Apple Silicon) and symmetrically links their files into /usr/local.

In this post, we will cover how to install Homebrew, the essential commands you need daily (structured as a cheat sheet), and my personal list of the top 10 most critical packages every developer should install.

Homebrew’s Origins: From macOS to Linux and WSL

Homebrew was created by Max Howell in 2009 to address the need for a better package management system on macOS, which at the time lacked a robust, user-friendly way to install open-source software from the command line. Before Homebrew, macOS users often had to compile software from source manually or rely on less integrated solutions like MacPorts or Fink, which could be cumbersome.

While Homebrew gained immense popularity on macOS, a separate project called Linuxbrew was later created to port Homebrew’s functionality to Linux. Eventually, in January 2019, Linuxbrew was officially merged back into the main Homebrew project, providing official support for Linux and Windows Subsystem for Linux (WSL).

So, to clarify:

  • Homebrew originated on macOS.
  • Linux support came later through the Linuxbrew project, which was then integrated into the main Homebrew.

This history is why Homebrew is still most strongly associated with macOS, and its “cask” functionality for graphical applications remains exclusively for macOS.

Installing and Configuring Homebrew on macOS

1. Installation

Before installing Homebrew, ensure you have Xcode Command Line Tools installed. You can check by opening your Terminal and running:

xcode-select --install

Follow the prompts to install them if they’re not already present.

Now, to install Homebrew, open your Terminal application and paste the following command. This command is provided on the official Homebrew website and downloads and executes the installation script.

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

The script will explain what it’s about to do and prompt you to confirm the installation by pressing Enter. You may also need to enter your macOS user password. Once complete, Homebrew will display instructions to add it to your system’s PATH environment variable. This step is crucial for brew commands to work from any directory.

For example, if you’re using Zsh (the default shell on modern macOS), you’ll typically see something like:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrc
eval "$(/opt/homebrew/bin/brew shellenv)"

Make sure to run these commands as instructed by the installer. If you’re using Bash, the file might be ~/.bash_profile or ~/.bashrc.

Fixing “zsh: command not found: brew”

Verbatim error: zsh: command not found: brew

Cause: the installer placed the brew binary in /opt/homebrew/bin (Apple Silicon) or /usr/local/bin (Intel), but the current shell’s PATH has not been updated yet.

Fix: add the shellenv line to your shell profile and reload it:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrc
source ~/.zshrc

Restarting Terminal after this also works.

2. Basic Usage Cheat Sheet

Homebrew refers to standard command-line tools as “formulae.” Here is a cheat sheet of the most critical commands you will use daily:

Command Action Explanation
brew update Update Homebrew Fetches the newest version of Homebrew and all package formulae from GitHub. Always run this first.
brew install <pkg> Install Package Downloads and installs the formula, automatically resolving and installing any dependencies.
brew upgrade Upgrade Everything Updates all outdated installed packages to their newest versions.
brew upgrade <pkg> Upgrade Single Updates only the specific package named.
brew uninstall <pkg> Remove Package Cleanly uninstalls the package.
brew search <term> Search Library Searches the Homebrew directory for packages matching your term.
brew info <pkg> View Metadata Displays the package version, installation path, dependencies, and any post-install caveats.
brew list List Installed Shows everything currently installed on your system via Homebrew.
brew cleanup Free Disk Space Removes old versions of installed packages and clears the download cache.
brew doctor Diagnostics Checks your system for potential issues (e.g., unlinked binaries, permission errors) and suggests fixes.

Homebrew Cask: Installing Graphical Applications on macOS

Homebrew Cask extends Homebrew’s functionality to allow you to install macOS graphical applications (like Chrome, Visual Studio Code, Spotify) with a single command. Homebrew Cask represents the same dependency-resolving package-management model as core Homebrew, applied to GUI application installation instead of command-line formulae.

Homebrew Cask Command Reference

Cask commands are seamlessly integrated into the standard brew CLI. By passing the --cask flag, you target graphical applications instead of terminal binaries.

Command Action Example
brew install --cask <app> Install GUI App brew install --cask visual-studio-code
brew uninstall --cask <app> Remove GUI App brew uninstall --cask spotify
brew upgrade --cask Upgrade All GUI Apps Updates all your installed Casks to their latest versions.
brew search --cask <term> Search GUI Apps brew search --cask firefox
brew list --cask List GUI Apps Shows only the graphical applications you have installed via Homebrew.

Homebrew for Linux and Windows (via WSL)

Homebrew is also available for Linux and Windows Subsystem for Linux (WSL), acting as a universal package manager across these environments. The installation process is very similar to macOS.

Installation for Linux / WSL

  1. Install dependencies: Before installing Homebrew, you’ll need a few essential packages.
    • For Debian/Ubuntu-based systems:
      sudo apt-get install build-essential procps curl file git
      
    • For Fedora/CentOS/RHEL systems:
      sudo yum groupinstall 'Development Tools'
      sudo yum install procps-ng curl file git
      
  2. Run the installation script: Similar to macOS, use the curl command to download and execute the Homebrew installation script.
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    

    The script will guide you through the process, prompting for your password and providing PATH configuration instructions, which will typically involve adding a line like eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" to your ~/.bashrc or ~/.profile file.

Usage for Linux / WSL

Once installed, the usage of brew commands on Linux and WSL is identical to macOS for installing and managing formulae (command-line tools).

Important Note for WSL: Homebrew Cask, which installs graphical applications, is generally not applicable directly on WSL because WSL itself is a command-line environment and doesn’t natively run macOS graphical applications. You’d typically install Windows applications directly on your Windows system.

Top 10 Essential Homebrew Packages for Developers

Once you have Homebrew installed, you have access to thousands of tools. Based on my daily workflow, here are the 10 absolute essentials I install immediately on any new machine.

Package Install Command Why You Need It
Git brew install git Apple’s default Git is often outdated. Homebrew keeps you on the latest release with all the newest features.
Python brew install python Essential for scripting, AI development, and running modern web frameworks.
Node.js brew install node Required for running JavaScript outside the browser and using frontend package managers like npm.
Tmux brew install tmux A terminal multiplexer. It lets you manage multiple terminal sessions in one window and keeps them alive in the background.
Htop brew install htop A vastly superior, interactive, and colorized alternative to macOS’s default top activity monitor.
Fzf brew install fzf An incredibly fast “fuzzy finder” for your terminal. It makes searching through command history and file directories instant.
Wget brew install wget The standard tool for reliably downloading files, scripts, or entire directories from the web via the CLI.
Ripgrep brew install ripgrep A blazing-fast alternative to grep that respects your .gitignore files automatically when searching through codebases.
PostgreSQL brew install postgresql The industry standard open-source SQL database. Essential for local backend development.
Docker brew install --cask docker The easiest way to get the Docker Desktop Daemon running on macOS so you can start containerizing your apps.

Homebrew FAQ

What is the difference between Homebrew and Linuxbrew?

Linuxbrew was originally a separate port of Homebrew for Linux. It was merged back into the main Homebrew project in January 2019, so today a single brew install works identically on macOS, Linux, and WSL, with Homebrew Cask remaining macOS-only.

Why does the terminal say ‘command not found: brew’ after installing Homebrew?

The installer places brew in /opt/homebrew/bin (Apple Silicon) or /usr/local/bin (Intel), but your shell’s PATH is not updated until you add the eval "$(brew shellenv)" line to your shell profile and reload it, either by restarting Terminal or running source ~/.zshrc.

What does brew doctor do and when should I run it?

brew doctor checks your system for potential issues, such as unlinked binaries or permission errors, and suggests fixes. Run it whenever a formula fails to install or behaves unexpectedly.

Can I use Homebrew Cask on Linux or WSL?

No. Homebrew Cask installs macOS graphical applications and depends on macOS-specific mechanisms, so it is not applicable on Linux or WSL. Install Windows applications directly on Windows instead.

How do I update every package installed via Homebrew?

Run brew update first to fetch the latest formulae, then brew upgrade to update all outdated installed packages to their newest versions.

Conclusion: Homebrew as the Standard Package Manager for macOS and Linux

Homebrew represents the de facto standard command-line package manager for macOS and, via the 2019 Linuxbrew merge, for Linux and WSL as well, replacing manual source compilation and dependency resolution with a single install command. If you haven’t used Homebrew yet, go ahead: install it, explore its capabilities, and take full advantage of the open-source software available at your fingertips.

References

  1. Homebrew Official Website
  2. Homebrew Installation Guide
  3. Homebrew Cask Usage (GitHub)
  4. Homebrew Repository
  5. Top 20 Homebrew Packages for Developers in 2024 - bold-brew.com
  6. Top Brew Packages You Should Know About - Howik
  7. 9 of the Best Homebrew Packages for Mac - OS X Daily
desktop bg dark

About Elena

Elena, a PhD in Computer Science, simplifies AI concepts and helps you use machine learning.

Citation
Elena Daehnhardt. (2025) 'Brewing with Homebrew', daehnhardt.com, 11 August 2025. Available at: https://daehnhardt.com/blog/2025/08/11/homebrew-setup-and-usage/
All Posts