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 the missing package manager for macOS (and Linux/WSL). 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.
History
It 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.
Homebrew for macOS: A Simple Tutorial
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.
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.
Usage with Cask
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
- 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
- For Debian/Ubuntu-based systems:
- Run the installation script: Similar to macOS, use the
curlcommand 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
PATHconfiguration instructions, which will typically involve adding a line likeeval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"to your~/.bashrcor~/.profilefile.
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.
My Top 10 Essential Homebrew Packages
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. |
Conclusion
Homebrew is a great package manager, and if you haven’t used it yet, go ahead—install Homebrew, explore its capabilities, and take full advantage of the open-source software available at your fingertips!