What Homebrew Does and Why You Need It
Homebrew is a package manager that installs command-line tools, libraries, and applications on macOS without requiring you to hunt down installers or compile code yourself. Once installed, you type a single command like brew install node to get Node.js, or brew install postgresql to get a database — Homebrew downloads the right version, puts it in the right place, and makes it available in your terminal when ready.
You need Homebrew because macOS does not come with most development tools built in. Without it, installing something like Git, Python, or a web server means finding the official website, downloading a file, running an installer, and hoping it ends up somewhere your terminal can find it. Homebrew automates that entire process and keeps track of what you installed so you can update or remove it later with a single command.
Key Takeaways
- Homebrew requires Xcode Command Line Tools, which you install first by running a single command in Terminal.
- The Homebrew installation command is a single line you paste into Terminal, and it downloads and runs an installer script automatically.
- After installation completes, you verify it worked by typing brew --version in Terminal.
- Once Homebrew is installed, you install any tool or library by typing brew install followed by its name.
Install Xcode Command Line Tools First
Homebrew needs Xcode Command Line Tools — a set of compilers and build tools that come from Apple — to work. You do not need the full Xcode process, only the command-line version. Open Terminal (search for it in Spotlight by pressing Command + Space, typing "Terminal", and pressing Enter) and paste this command:
xcode-select --install
A dialog box appears asking if you want to install the tools. Click Install. The read is about 500 MB and takes 5 to 15 minutes depending on your internet speed. When it finishes, you will see a message saying the installation was successful. You do not need to do anything else — just close the dialog.
If you already have Xcode Command Line Tools installed, the command tells you so and does nothing. Running it again is harmless.
Run the Homebrew Installation Command
Once Xcode Command Line Tools is installed, go back to Terminal and paste this single command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Press Enter. Terminal downloads a script from Homebrew's GitHub repository and runs it automatically. The script asks for your Mac password — type it in (you will not see the characters appear, which is normal) and press Enter. Homebrew then downloads and installs itself, which takes 2 to 5 minutes.
When the installation finishes, Terminal shows a message saying "Installation successful!" and may tell you to run additional commands. If it does, copy and paste those commands exactly as shown and press Enter after each one. These commands add Homebrew to your system path so Terminal can find it.
Verify the Installation Worked
After installation completes, verify that Homebrew is working by typing this command in Terminal:
brew --version
Press Enter. If Homebrew installed correctly, Terminal shows a version number like "Homebrew 4.0.1" or similar. If you see an error like "command not found", the installation did not complete properly — scroll back through the Terminal output to see if there were error messages, or try running the installation command again.
You can also check that Homebrew is set up correctly by running:
brew doctor
This command checks your system for common problems. If everything is fine, it says "Your system is ready to brew." If it finds issues, it tells you how to fix them — usually the fixes are straightforward and Homebrew explains them clearly.
Install Your First Tool with Homebrew
Now that Homebrew is installed, you can install any tool or library it has a recipe for. The command structure is always the same: brew install followed by the name of what you want. For example, to install Git (a version control system), type:
brew install git
Press Enter. Homebrew downloads the latest version of Git, compiles it if needed, and installs it in a standard location where Terminal can find it. When it finishes, you can use Git when ready by typing git --version to confirm it is there.
Other common first installs are brew install node for Node.js, brew install python for Python, or brew install postgresql for a database. You can install as many tools as you need — Homebrew keeps track of all of them and can update them all at once with brew upgrade.
Update and Manage Installed Tools
Homebrew makes it straightforward to keep your tools current. To see what you have installed, type:
brew list
To update all your installed tools to their latest versions, type:
brew upgrade
To remove a tool you no longer need, type brew uninstall followed by its name — for example, brew uninstall node. Homebrew removes the tool completely and cleans up after itself.
You can also search for tools before installing them. Type brew search followed by a keyword — for example, brew search database shows all database tools Homebrew has recipes for. This is useful when you know what you want to do but are not sure what tool to use.
Troubleshooting Common Installation Problems
If the installation command fails with a permission error, your Mac user account may not have permission to write to the directories Homebrew needs. Try running the command with sudo at the beginning — type sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" and enter your password when prompted. This is less common on modern Macs but sometimes necessary.
If Terminal says "curl: command not found" or similar, Xcode Command Line Tools did not install correctly. Go back and run xcode-select --install again, wait for it to finish, and then try the Homebrew installation command again.
If you installed Homebrew but Terminal still says "brew: command not found", the installation script did not add Homebrew to your path. Look at the final messages the installer printed — it usually tells you to run a command like echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile. Copy that exact command, paste it into Terminal, press Enter, then close Terminal completely and open it again. Homebrew should work after that.
Frequently Asked Questions
Do I need to pay for Homebrew?
No. Homebrew is free and open-source. The tools and libraries it installs may have their own licenses — some are free, some are commercial — but Homebrew itself costs nothing.
Can I use Homebrew on an M1 or M2 Mac?
Yes. Homebrew works on both Intel and Apple Silicon Macs. The installation process is identical. Some older tools may not have versions for Apple Silicon yet, but Homebrew handles that automatically and installs the Intel version if needed.
What happens if I uninstall Homebrew?
All the tools Homebrew installed stay on your Mac, but you lose the ability to update them or manage them through Homebrew. To uninstall Homebrew itself, run /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/uninstall/HEAD/uninstall.sh)" in Terminal. You can reinstall it anytime by running the installation command again.
Can I install Homebrew if I already have some tools installed?
Yes. Homebrew can coexist with tools you installed other ways. However, if you already have a tool installed outside of Homebrew and then install the same tool through Homebrew, you may end up with two versions. Homebrew will use its version, but the old one still takes up space. You can remove the old version manually or let Homebrew manage it going forward.
How do I know what tools are available to install?
Search the Homebrew website at brew.sh, or type brew search followed by a keyword in Terminal. You can also type brew info followed by a tool name to see details about it before installing — for example, brew info node shows information about Node.js.