Installing Homebrew on macOS is the first step toward streamlining your development workflow and gaining access to a vast ecosystem of open-source command-line tools. This package manager acts as a missing package manager that the macOS system does not provide out of the box, allowing you to install, update, and manage software with simple terminal commands rather than dragging icons to and from the Applications folder.
Understanding What Homebrew Is and Why You Need It
Homebrew, often referred to as "the missing package manager for macOS," sits on top of the system’s standard directory structure and installs packages into its own prefix. This isolation prevents conflicts with system files while keeping your user-space applications organized. Unlike manual downloads, Homebrew handles dependencies automatically, ensuring that when you install a tool like Python or Node, every supporting library is placed exactly where it needs to be.
Checking Your System Compatibility
Before you run the installer, it is wise to verify that your environment is ready. Homebrew requires macOS version 10.13 or later, although newer versions of macOS yield the best performance and security. You should also ensure that Xcode Command Line Tools are installed, as they provide the essential compilers and system headers required to build software from source. You can check this by opening Terminal and typing xcode-select --install if the tools are not already present.
Minimum Requirements
macOS 10.13 (High Sierra) or newer.
Administrator access to your user account.
A stable internet connection for downloading the installer and packages.
Executing the Installation Command
The easiest way to install brew mac is to use the official shell script provided by the Homebrew project. You can run this directly from the Terminal by piping the script from their remote repository into your local shell session. This method is safe because the script is maintained by the Homebrew core team and is designed to be idempotent, meaning you can run it multiple times without causing system errors.
Step-by-Step Terminal Commands
Open your Terminal application, which you can find in Applications > Utilities . Copy the following command exactly as shown and paste it into the Terminal window, then press Enter:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" The script will display a license agreement and proceed to download the necessary files. It will ask for your administrator password to move files into protected system directories; this is a standard security step for any macOS installation.
Configuring Your Shell Environment
Once the script completes, you must configure your shell to recognize the brew command. The installer will output specific instructions for your shell, usually adding a line to your profile configuration file. For users of zsh , which is the default on macOS Catalina and later, this involves editing ~/.zprofile . For older systems using bash , the file is ~/.bash_profile .
Environment Variables
Homebrew modifies your PATH environment variable so that the Terminal checks the Homebrew directory before the system directories. This ensures that the versions of tools you install via Homebrew take precedence over the older, built-in macOS utilities. You can verify the configuration by opening a new Terminal window and typing echo $PATH , looking for the /usr/local/bin or /opt/homebrew/bin entry.