xcode-select --install
Xcode is an integrated development environment (IDE) that consists of software development tools for macOS. You won’t need Xcode to use Homebrew, but some of the software and components you’ll want to install will rely on Xcode’s Command Line Tools package.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
The above command will download the installation script and then execute the
script with the bash
command.
You need to add Homebrew’s executable directory to the front of the
PATH
to prioritize its tools over macOS defaults.
Run the following command to determine your shell. You’ll see either bash
or zsh
.
echo $0
If you’re using ZSH, open the file ~/.zshrc
in your editor:
nano ~/.zshrc
If you’re using the Bash shell, use the file ~/.bash_profile
:
nano ~/.bash_profile
Add the following lines to the end of the file:
export PATH=/opt/homebrew/bin:$PATH
To save your changes, press ^ and O, and when prompted, press the RETURN key. Then exit the editor by pressing ^ and X. This will return you to your Terminal prompt.
Use the below source command to activate the changes, based on which file you modified:
source ~/.zshrc
or
source ~/.bash_profile
brew doctor
If no updates are required at this time, you’ll see this in your Terminal:
Your system is ready to brew.