If you’re a macOS user and want to install software or developer tools effortlessly through the terminal, Homebrew is a must-have. It’s the most popular package manager for macOS that simplifies installing, updating, and managing command-line tools and applications.
In this guide, we’ll cover everything you need to know, from what Homebrew is to how to install and verify it on your Mac.
What is Homebrew?
Homebrew (or simply brew) is an open-source package manager designed for macOS (and Linux). It allows you to install software using simple commands instead of manually downloading and configuring applications.
Think of it like an App Store for your Terminal — fast, lightweight, and developer-friendly.
Key features:
- Install software with one command.
- Easily update and uninstall tools.
- Manage dependencies automatically.
- Extend functionality via “taps” and “casks”.
Prerequisites
Before installing Homebrew, make sure your Mac meets the following requirements:
- macOS version: macOS 10.14 (Mojave) or later.
- Command Line Tools for Xcode: Homebrew relies on Apple’s developer tools to compile and build software.
- Administrator access: You’ll need
sudo
privileges to install Homebrew.
Step 1: Install Apple Command Line Tools
Open the Terminal app (press Command + Space
, type Terminal, and hit Enter).
Then, run this command:
xcode-select --install
A dialog box will appear asking to install Command Line Developer Tools.
Click Install and wait for the installation to complete.
Once done, verify by running:
xcode-select -p
If it returns a valid path (like /Library/Developer/CommandLineTools
), the tools are installed successfully.
Step 2: Install Homebrew
Now that the prerequisites are ready, you can install Homebrew using a single command.
Run the following command in Terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
What this command does:
- Downloads the official Homebrew installation script from GitHub.
- Verifies the integrity of the script.
- Installs Homebrew into the default directory:
/usr/local
for Intel-based Macs./opt/homebrew
for Apple Silicon (M1, M2, M3) Macs.
You might be prompted to enter your password during installation.
Once done, you’ll see a success message similar to:
==> Installation successful! ==> Next steps: Run these two commands in your terminal: echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)"
Step 3: Add Homebrew to Your PATH
To make the brew
command available globally, you need to add it to your shell environment.
For Apple Silicon (M1/M2/M3 Macs):
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)"
For Intel-based Macs:
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zprofile eval "$(/usr/local/bin/brew shellenv)"
This ensures your terminal recognizes Homebrew commands in all new sessions.
Step 4: Verify Homebrew Installation
Once installed, confirm that Homebrew works correctly:
brew --version
If everything is set up, you’ll see an output similar to:
Homebrew 4.3.3 Homebrew/homebrew-core (git revision ...) Homebrew/homebrew-cask (git revision ...)
To check if your setup is healthy, run:
brew doctor
If it returns “Your system is ready to brew.”, you’re good to g
Step 5: Install Your First Package
Let’s try installing a simple package like wget (a command-line downloader):
brew install wget
To confirm installation:
wget --version
You can also explore more available software by searching:
brew search <package-name>
Example:
brew search python
Step 6: Update & Upgrade Homebrew
Homebrew is actively maintained. Keep it up-to-date using:
brew update brew upgrade
brew update
updates the list of available packages.brew upgrade
upgrades all installed packages to their latest versions.
Step 7: Uninstall or Cleanup Homebrew Packages
To uninstall a package:
brew uninstall <package-name>
To remove old versions and clean up unused files:
brew cleanup
Bonus: Homebrew Cask for macOS Apps
Homebrew isn’t just for command-line tools — you can also install GUI apps like Google Chrome, VS Code, and Slack using Homebrew Cask.
Example:
brew install --cask visual-studio-code brew install --cask google-chrome
To list all installed casks:
brew list --cask
Common Issues & Fixes
Issue | Solution |
---|---|
brew: command not found | Add Homebrew to your PATH again (Step 3). |
Permission errors | Run the command with sudo or adjust directory ownership. |
Slow downloads | Use a mirror with brew install --verbose or check your network. |
Outdated Xcode tools | Run xcode-select --install again to update. |
FAQs
1. What is Homebrew used for on Mac?
Homebrew is a package manager that simplifies the installation and management of software on macOS. It helps developers quickly install tools, libraries, and applications directly from the Terminal.
2. Is Homebrew safe to install?
Yes, Homebrew is completely safe and open-source. It’s maintained by a large community of developers and used by millions worldwide. Always install it from the official GitHub source.
3. Do I need Xcode to install Homebrew?
No, you don’t need the full Xcode app. You only need the Command Line Tools, which can be installed using xcode-select --install
.
4. Where does Homebrew install software on Mac?
- On Intel Macs, it installs packages in
/usr/local/
. - On Apple Silicon (M1/M2/M3) Macs, it installs in
/opt/homebrew/
.
5. How do I uninstall Homebrew completely?
You can remove Homebrew by running the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
6. How do I update Homebrew?
Simply run:
brew update brew upgrade
This ensures you have the latest versions of both Homebrew and your installed packages.
7. Can I use Homebrew on Linux?
Yes! Homebrew also supports Linux. The installation command is similar, but the directory paths differ slightly.
8. What’s the difference between brew install
and brew install --cask
?
brew install
→ Installs command-line tools.brew install --cask
→ Installs GUI applications (like Chrome or VS Code).
Conclusion
Homebrew is one of the most essential tools for macOS users, especially developers, sysadmins, and tech enthusiasts. With just a few commands, you can manage thousands of software packages seamlessly.