How to Install Homebrew on Mac
Advanced Mac users may appreciate using the Homebrew package manager, which greatly simplifies the process of installing command line software and tools on a Mac.
For example, if you want to easily install favorite command line tools on a Mac like cask, htop, wget, nmap, tree, irssi, links, colordiff, or virtually any other familiar unix command line utility, you can do so with a simple command. Homebrew downloads and builds the package for you.
Requirements for Installing Homebrew on Mac OS
prerequisites to installing Homebrew on a Mac include the following:
- A Mac running Mac OS X 10.10 or later, though earlier versions are sort of supported
- Command Line Tools must be installed on the Mac (either independently or through Xcode)
- Knowledge of the command line and using bash or zsh
Assuming you’re interested in installing Homebrew and meet those requirements, then the rest is equally straight forward.
How to Install Homebrew on Mac OS
Step 1: Open the “Terminal” application, found in /Applications/Utilities/
Step 2: First of all, you need command line tools to install Xcode. On a modern Mac OS X system, you can install it by running the following command in a Terminal command line window. You can also install the full Xcode app from Apple, if you like – but it takes up more storage space on your Mac and isn’t necessary.
[email protected] ~ % xcode-select --install
Step 2: Install Homebrew
For MacOS Catalina, macOS Mojave, and MacOS Big Sur:
[email protected] ~ % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
For macOS High Sierra, Sierra, El Capitan, and earlier:
[email protected] ~ % /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Step 3: Hit Return and you’ll see a series of lines about what the script will install and where, hit Return again to agree or hit Escape to cancel
Step 4: Enter the administrator password (required by sudo execution) to begin installation
Step 5: Run the following command when you’re done to make sure Homebrew is installed and working properly.
[email protected] ~ % brew doctor
Step 6: Once you’re done, run the following command to install Homebrew Cask. It uses Homebrew to install Cask:
[email protected] ~ % brew install caskroom/cask/brew-cask
Installing Software Packages through Homebrew on Mac
To search for a packages:
brew search [package name]
Installing packages with Homebrew is super easy, just use the following syntax:
brew install [package name]
To remove an package from the system:
brew remove [package name]
For example, to install wget through Homebrew you could use the following syntax:
[email protected] ~ % brew install wget
How to Remove HomeBrew from a Mac
If you have installed Homebrew but later decide you want to remove Homebrew from a Mac for some reason or another, you can uninstall it with another ruby script run from the command line, choose the script that aligns with your version of MacOS:
Removing Homebrew in MacOS Catalina, macOS Big Sur, and MacOS Mojave:
[email protected] ~ % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
Removing Homebrew from MacOS High Sierra, Sierra, El Capitan, and earlier:
[email protected] ~ % ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Alternatively, you could download that “uninstall” script directly and run it yourself.