How to Install and Use Homebrew on macOS
· Category: VS Code & Developer Tools
Short answer
Homebrew is the most popular package manager for macOS. It installs command-line tools and GUI apps from the terminal using simple commands.
Steps
- Open Terminal and paste the installation command from brew.sh.
- Wait for the script to install Xcode Command Line Tools and Homebrew.
- Run
brew doctorto verify the installation. - Install packages with
brew install <package>, such asbrew install git. - Upgrade all packages with
brew update && brew upgrade.
Tips
- Use
brew caskto install GUI applications like VS Code or Chrome. - Pin a package to prevent it from upgrading with
brew pin <package>. - Regularly run
brew cleanupto free disk space from old versions.
Common issues
- Permission errors often mean you need to fix directory ownership with
sudo chown. - The M1/M2 Mac requires some packages to run under Rosetta or ARM-specific taps.