How to Install Homebrew
Install Homebrew on macOS to easily manage and update software from the command line.
Homebrew is a powerful package manager for macOS that simplifies software installation. Follow these steps to install and configure Homebrew on your Mac.
Step 1: Install Xcode Command Line Tools
Before installing Homebrew, install Xcode Command Line Tools by running:
1
xcode-select --install
Follow the prompts to complete the installation.
Step 2: Install Homebrew
Once the command line tools are installed, run the following command in Terminal:
1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
This will download and run the Homebrew installation script.
Step 3: Enter Your Password
When prompted, enter your administrator password (you won’t see characters while typing for security reasons).
Step 4: Follow Installation Instructions
The installation script will guide you through the process. Follow the on-screen instructions and confirm as needed.
Step 5: Set Up Homebrew Path
After installation, you need to add Homebrew to your PATH. The steps depend on your shell:
For Zsh (default on macOS Catalina and later):
Edit your ~/.zshrc file and add:
1
export PATH=/usr/local/bin:$PATH
Then, apply the changes:
1
source ~/.zshrc
For Bash:
Edit your ~/.bash_profile file and add:
1
export PATH=/usr/local/bin:$PATH
Apply the changes:
1
source ~/.bash_profile
Step 6: Verify Installation
To confirm that Homebrew is correctly installed, run:
1
brew doctor
If everything is set up correctly, you should see: Your system is ready to brew.
Step 7: Update Homebrew (Optional)
To keep Homebrew updated, run:
1
brew update
This ensures you always have the latest package versions.
Conclusion
You’ve successfully installed Homebrew on your Mac! Now, you can install packages using:
1
brew install package-name
Enjoy efficient package management with Homebrew! 🚀
☕ Support My Work
If you found this post helpful and want to support more content like this, you can buy me a coffee!
Your support helps me continue creating useful articles and tips for fellow developers. Thank you! 🙏