Installing Homebrew on macOS is the standard first step for developers who want to take control of their development environment. This command-line package manager eliminates the manual process of downloading, installing, and managing software on your Mac, allowing you to install utilities and applications with a single terminal command.
Understanding Homebrew and Its Value
Homebrew, often referred to as the missing package manager for macOS, sits between the operating system and the software you need. Unlike downloading binaries from random websites, it installs software into a local directory, keeping your system files clean and organized. It handles dependencies automatically, so you do not have to manually track down libraries or installers to get a specific tool running.
Checking System Requirements
Before you begin the installation, ensure your Mac is compatible. The process requires macOS 10.13 or later, which covers virtually all modern Macs from the last decade. You will also need administrative access to your machine to allow the installation of command-line tools, which are necessary for compiling software.
Required Command Line Tools
Xcode Command Line Tools are a prerequisite for the installation. These tools provide the compilers and utilities required to build software from source. If you do not have them installed, the Homebrew installer will prompt you to install them automatically, but you can also install them manually by running xcode-select --install in your terminal.
Executing the Installation Command
The recommended way to install Homebrew is through the official shell script. This process is designed to be simple and safe, placing all files in the /opt/homebrew directory for Apple Silicon chips or /usr/local for Intel processors. Follow these steps to install:
Step-by-Step Process
Open the Terminal application, which you can find in Applications > Utilities.
Paste the official installation command into the terminal window. The command is /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" .
Press return and authenticate the script by entering your user password when prompted.
Wait for the script to complete, which usually takes a few minutes depending on your internet speed.
Verifying the Installation
Once the script finishes, you need to verify that Homebrew was installed correctly and is ready to use. The terminal will usually output a message prompting you to add Homebrew to your PATH. It will also display a command you can run to ensure everything is working as expected.
Updating the Shell Profile
To ensure your shell recognizes the Homebrew commands, you may need to update your profile file. Add the export path printed by the installer to your .zprofile or .bash_profile . For example, you can run echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile and then run eval "$(/opt/homebrew/bin/brew shellenv)" to apply the changes immediately.
Testing the Installation
To confirm everything is working, run brew doctor in your terminal. This command checks your system for any issues that might interfere with Homebrew, such as unlinked files or incorrect permissions. If the output states "Your system is ready to brew," you are successfully set up and ready to install software.