Here are Homebrew’s official website and Wikipedia’s record of it
https://brew.sh/
https://github.com/Homebrew/brew
https://en.wikipedia.org/wiki/Homebrew_(package_manager)
Run the following command:
which brew
If the output is empty, it means Homebrew is not installed and needs to be installed.
If you haven’t installed Homebrew yet, you can execute the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
During the installation process, you may be prompted to enter a password. Enter it and press Enter to continue.
After installation, Homebrew may not be automatically added to PATH, you need to configure it manually:
For Apple Silicon (M1/M2/M3):
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrc
eval "$(/opt/homebrew/bin/brew shellenv)"
For Intel Mac:
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zshrc
eval "$(/usr/local/bin/brew shellenv)"
Then execute:
source ~/.zshrc
Check if it works:
brew --version
If the version number is displayed correctly, Homebrew has been successfully configured.
Homebrew can also install macOS GUI applications (such as Google Chrome, VS Code):
brew install --cask google-chrome
brew install --cask visual-studio-code
This way you don’t have to download .dmg from the official website and manually drag and install it.