Homebrew – the missing package manager for macOS. Probably the most popular package manager for macOS, Homebrew provides an easy way to install UNIX tools and binary apps.
Let’s look at how to install and use Homebrew on M1 and M2 Macs running macOS Monterey.
NOTE: Apple replaced bash with zsh as the default Terminal shell in macOS Catalina. If the screenshots below look slightly different than what you see on your screen, I’m using zsh + oh-my-zsh.
INSTALLATION
1. Open terminal and run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Authenticate when prompted to.
2. Be patient, after a minute or so, Homebrew will be installed on your Mac.
3. However, if you run brew
you’ll get…
4. That’s because you have to add Homebrew to your path. To do that, you’ll have to edit your .zshrc
file and add the following at the bottom.
export PATH=/opt/homebrew/bin:$PATH
export PATH=/opt/homebrew/sbin:$PATH
NOTE: you can edit from the terminal by running vim .zshrc
or with a file editor. However the file is hidden. Learn how to toggle visibility of hidden files in macOS.
5. Install cask with brew install cask
. Packages available in homebrew are not usually for the average home user. You will need/want cask to take full advantage of homebrew.
6. That’s it you’re done!
ANALYTICS & Update
According to Homebrew’s Anonymous Aggregate User Behaviour Analytics, Homebrew gathers anonymous aggregate user behavior analytics and reports these to Google Analytics.
To opt-out of Homebrew’s analytics, run brew analytics off
. To check if analytics is disabled, run brew analytics
.
To update Homebrew, run brew update
. To update outdated packages, run brew upgrade
.
NOTE: To avoid typing the above commands over and over I suggest creating an alias ( i.e bup="brew update && brew upgrade"
)
SEARCH, INSTALL & UNINSTALL
To search for an app use brew search name
. To install an app use brew install name
or brew install --cask name
. To uninstall use brew uninstall name
or brew uninstall --cask name
.
See more options by running brew --help
That’s pretty much it. Homebrew is useful, fun, and fast. If you’re not using it yet, give it a try