Instructions to Install Homebrew on macOS
Homebrew is a popular package manager for macOS that simplifies the installation of software and tools. Follow these steps to install Homebrew on your Mac:
Step 1: Open Terminal​
- Open the Terminal application on your Mac.
- You can find it in Applications > Utilities > Terminal.
Step 2: Run the Installation Command​
-
Copy and paste the following command into your terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Press Enter to execute the command.
Step 3: Follow the On-Screen Instructions​
- The installation script will prompt you to:
- Install Command Line Tools for Xcode (if not already installed). Follow the on-screen instructions to complete this step.
- Provide your system password for permission to install Homebrew.
- Confirm installation paths.
Step 4: Add Homebrew to Your Shell Configuration​
After the installation is complete, you may need to add Homebrew to your shell configuration file to ensure it works properly.
For Zsh (Default Shell on macOS Catalina and Later):​
-
Update your
.zshrcfile:echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrcsource ~/.zshrc
For Bash​
-
Update your
.bash_profilefile:echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.bash_profilesource ~/.bash_profile
Step 5: Verify Installation​
-
Run the following command to check if Homebrew is installed correctly:
brew --versionYou should see the installed version of Homebrew.
Step 6: Install Software Using Homebrew​
Once Homebrew is installed, you can use it to install software and tools. For example:
brew install python
Step 7: Keep Homebrew Updated​
To ensure Homebrew and its packages are up-to-date, run:
brew update
Notes​
- Homebrew installs packages in
/opt/homebrewon Apple Silicon Macs and/usr/localon Intel Macs. - If you encounter any issues during installation, refer to the Homebrew documentation for troubleshooting tips.