Homebrew is a popular package manager for macOS that simplifies the installation of software. This guide will walk you through installing, using, and uninstalling Homebrew on macOS.
If you've used package managers like npm for Node.js or pip for Python, Homebrew works similarly but for macOS software. It allows you to install and manage packages easily via the command line.
Before installing Homebrew, ensure that:
xcode-select --install
If it's already installed, you will see a message confirming this.To install Homebrew, follow these steps:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
brew --version
If successful, it should return the installed version number.To test Homebrew, let's install wget
, a command-line utility for downloading files from the web:
brew install wget
Once installed, confirm it works by downloading Google’s homepage:
wget https://www.google.com
You should see an index.html
file in your directory.
If you no longer need Homebrew, you can remove it with the following steps:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
sudo rm -rf /opt/homebrew
vi ~/.zprofile
Delete the line referencing Homebrew and save the file (dd
to delete the line, then :wq!
to save and exit).brew --version
If Homebrew is successfully uninstalled, this command should return an error.Now you know how to install, use, and remove Homebrew on macOS. It’s a powerful tool that simplifies package management, making software installation easier for developers and power users alike.