Introduction
In this post, we will provide an overview of Homebrew, a package manager that simplifies installing, updating, and managing software on macOS and Linux. It acts like an “app store” for command-line tools and other developer-centric software. For Windows, Homebrew primarily works within the Windows Subsystem for Linux (WSL).
Why Homebrew?
Homebrew is a free and open-source package manager primarily for macOS (and also available for Linux and Windows Subsystem for Linux).
In simple terms, think of it like an “App Store” but for developers and technical users, operated through your computer’s command line (Terminal). Instead of dragging and dropping application icons or going to various websites to download software, Homebrew lets you install, update, and manage a vast array of software with simple commands.
Here’s why it’s so popular:
- Simplifies Installation: Want to install a command-line tool like Git, Node.js, or Python? Instead of manually downloading and configuring them, you can type
brew install git
. - Manages Dependencies: Many software programs rely on other programs to work correctly (these are called “dependencies”). Homebrew automatically figures out and installs all the necessary dependencies for you.
- Keeps Software Up-to-Date: With a single command (
brew upgrade
), you can update all the software you’ve installed via Homebrew to their latest versions. - Clean Uninstallation: When you’re done with a program,
brew uninstall
removes it cleanly, along with its dependencies, preventing leftover files from cluttering your system. - Vast Library: Homebrew provides access to thousands of open-source software packages, including developer tools, utilities, and even some graphical applications (through “Homebrew Cask”).
- Command-Line Convenience: For developers and power users, working in the command line is often faster and more efficient. Homebrew integrates seamlessly with this workflow.
While it uses some playful terminology (like “formulae” for command-line tools and “casks” for GUI applications), its core purpose is to make managing software on your Mac much easier and more organised.
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
Here are some fundamental Homebrew commands:
- Update Homebrew itself: Always a good first step after installation or before installing new software.
brew update
- Check for issues: This command diagnoses potential problems with your Homebrew installation.
brew doctor
- Install a package (formula): To install command-line tools like
git
ornode
.brew install <package_name> # Example: brew install git
- Uninstall a package:
brew uninstall <package_name> # Example: brew uninstall git
- Upgrade a package: To update an installed package to its latest version.
brew upgrade <package_name> # Example: brew upgrade git
- Upgrade all outdated packages:
brew upgrade
- List installed packages:
brew list
- Search for a package: Find packages available through Homebrew.
brew search <search_term> # Example: brew search python
- Get information about a package: Shows details like version, dependencies, and caveats.
brew info <package_name> # Example: brew info node
- Clean up old versions: Removes older versions of installed packages and stale download files to free up disk space.
brew cleanup
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 integrated into the brew
command, typically by adding --cask
or cask
.
- Install a graphical application (cask):
brew install --cask <app_name> # Example: brew install --cask google-chrome
- Uninstall a graphical application:
brew uninstall --cask <app_name> # Example: brew uninstall --cask google-chrome
- List installed graphical applications:
brew list --cask
- Upgrade all outdated casks:
brew upgrade --cask
- Search for a cask:
brew search --cask <search_term> # Example: brew search --cask firefox
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
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 likeeval "$(/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 Homebrew packages
List the 10 most essential Homebrew packages for macOS
ChatGPT 5 gave me this list:
Here are **10 really useful Homebrew packages for macOS**, chosen based on current recommendations and widely trusted developer lists. They make life smoother whether you're coding, using the terminal, or managing projects.
Essential Homebrew Packages for macOS
- git – The indispensable version control system every developer needs. ([5], [6])
- python – A versatile scripting language for automation, web development, and beyond. ([5])
- node – Lets you run JavaScript on your Mac, great for frontend tools and backend development. ([5])
- tmux – A terminal multiplexer: run and manage multiple sessions and panes right from the command line. ([5])
- htop – A smarter and more user-friendly version of the built‑in
top
, showing resource usage. ([5]) - fzf – A fast fuzzy finder for searching files, history, processes, and more—all from the terminal. ([5])
- wget – A handy tool for downloading files or entire directories directly from URLs via the command line. ([7])
- ripgrep (rg) – A blazing‑fast search tool for scanning code or text—much quicker than grep. ([5])
- postgresql – A powerful open-source SQL database, highly reliable and widely used. ([5])
- docker (via
--cask
) – Lets you containerize projects easily—even on macOS. ([5])
Why These Packages?
- Workforce essentials: Tools like git, tmux, and htop improve productivity and terminal workflows.
- Development flexibility: Python, Node.js, and Docker support building, testing, and packaging software across environments.
- Efficiency tools: wget, fzf, and ripgrep speed up file retrieval and searching—time-savers for any user.
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!