What is Homebrew (for Mac OS, not the homebrew you drink)
Homebrew is the Mac equivalent of an application package manager. Package managers are fundamental to Linux systems (which OS X / macOS is based on), for installing pretty much anything you may need at the command line level and also front-end applications. Although on your Mac Homebrew is only used for command / system level tools and applications. On Debian based Linux systems (such as Debian, Ubuntu, and others) there’s a tool called Advanced Package Tool, or APT for short, and it comes with the OS. Without getting into all the details, in this Mac Tip I will share basic instructions on how to install and use Homebrew. But first, let’s look at why you’d even bother.
Why use Homebrew?
For many Apple computer users, there’s no reason at all to use Homebrew. If you’re not someone that likes to tinker under the hood of your operating system, and use your computer for anything more than the common tasks performed through the graphical user interface (GUI), then Homebrew is likely not of much use to you. If, however, you like to make you Mac perform other tasks that the GUI doesn’t support, such as programming related tasks, then Homebrew is likely to be very handy. If you’re on of those people, you probably already have it installed, and know how to use it. Just in case you’re new to this, please go over the following instructions.
How to install Homebrew
Installing Homebrew is super simple.
- Open Terminal app.
- Type (or paste) in the command,
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Once that finishes doing it’s thing, Homebrew should be installed. Type in
brew --versionand something like the following should show up:
Homebrew 3.1.9 Homebrew/homebrew-core (git revision 7bd3aacf5d; last commit 2021-05-29) Homebrew/homebrew-cask (git revision f350ee0a28; last commit 2021-05-28)
Keeping Homebrew updated
Before installing packages with Homebrew it’s a good idea to update its application repository data (basically its list of known applications), if you’ve not done so for some days or longer. Use this command:
If you want, you can have Homebrew update the repository data automatically. To set that up, run this command:
brew autoupdate start
This will have it check for updated repository data every 24 hours. If you want to set it to a different interval, you’d use the following command. The number on the end is in seconds. So for 12 hours, you’d set it to an interval of
brew autoupdate start 43200
You can also add on some other options, such as
--cleanup to automatically run brew upgrade and/or brew cleanup respectively. Add on the option
--enable-notification to send a notification when the autoupdate process has finished successfully.
Packages on Homebrew are known as Formulae. You can browse the available Formulae here.
Common Homebrew Commands
brew search <name>
Download and install that package
brew install <name>
Remove that package from your system later
brew remove <name>
Install graphical apps
Search for a graphical app
brew cask search <name>
To install an app use the following command (this will automatically download, extract the app, and install it to your Applications folder)
brew cask install <name>
Uninstall an app with Homebrew Cask
brew cask uninstall <name>
Update your local packages
First, update the formulae and Homebrew itself
See what is outdated
Upgrade a specific formula
brew upgrade <name>
Stop a formula from being updated
Stop something from being updated/upgraded
brew pin <name>
Allow that formula to update again
brew unpin <name>
Uninstall old versions of a formula
By default, Homebrew does not uninstall old versions of a formula. So when formulae are updated, Homebrew leaves the old stuff sitting around. The following commands for for cleaning that stuff up.
Clean up one specific formula
brew cleanup <formula name>
Clean up everything at once
To first see what would be cleaned up, without actually doing the cleaning:
brew cleanup -n
Uninstall a formula
Remove a formula entirely (only do this if you know what you’re doing)
brew uninstall --force <name>
Where does stuff get downloaded?
Which will usually return: ~/Library/Caches/Homebrew
To uninstall Homebrew, paste the command below in a Terminal prompt:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
More Homebrew information
There’s a lot of articles online about things you can do with Homebrew, including many tips on Best Mac Tips. If you’d like to dig deeper into it, take a look at the man page (the manual page or documentation) available here. You can also access the man in Terminal. Use the command