Homebrew - The macOS Package Manager
Homebrew is an essential package manager for macOS that allows you to easily install and manage software from the command line.
Installation
To install Homebrew, open Terminal and run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Follow the prompts and let the installation complete. You may need to add Homebrew to your PATH as directed in the post-installation instructions.
Basic Commands
Here are the essential Homebrew commands you should know:
Command | Description |
---|---|
brew install <package> | Install a package |
brew uninstall <package> | Uninstall a package |
brew update | Update Homebrew itself |
brew upgrade | Upgrade all packages |
brew upgrade <package> | Upgrade a specific package |
brew list | List installed packages |
brew search <term> | Search for packages |
brew info <package> | Get information about a package |
brew doctor | Check for issues with your Homebrew installation |
brew cleanup | Remove old versions of installed packages |
Homebrew Cask
Homebrew Cask extends Homebrew to allow installation of macOS applications and larger binaries:
# Install a macOS application
brew install --cask visual-studio-code
# List installed casks
brew list --cask
# Search for a cask
brew search --cask google
Recommended Packages
Command Line Tools
brew install git
brew install node
brew install python
brew install tree
brew install jq
brew install htop
brew install wget
brew install tldr
macOS Applications
brew install --cask visual-studio-code
brew install --cask iterm2
brew install --cask docker
brew install --cask rectangle
brew install --cask google-chrome
brew install --cask firefox
brew install --cask slack
Brew Bundle
Brewfile allows you to manage your Homebrew packages in a single file, similar to a package.json:
- Create a Brewfile:
# Create a Brewfile from your currently installed packages
brew bundle dump
- Install everything from a Brewfile:
brew bundle
This is especially useful when setting up a new Mac or sharing your setup with others.
Maintenance
Regularly run these commands to keep your Homebrew installation healthy:
brew update
brew upgrade
brew cleanup
brew doctor
Homebrew is constantly evolving, so check the official documentation (opens in a new tab) for the most up-to-date information.