Let’s face it, packages are boring and package managers are more boring. Sometimes a tutorial might tell you to install a command line package. You could certainly install the package and update it manually, but if you have ten packages it might become laborious to manage them all. Homebrew lets you update them all at once, and generally helps in the chore of managing shell packages.
I will cover the most useful things first so you can get back to the tutorial and carry on with the fun stuff. But the truly curious can read to the end.
To install a package:
brew install <formula>
In brew terms a formula is a package
Update the package database:
It’s a curated list of popular packages. It works and that’s all I care about.
Upgrade all packages:
If there are any new versions it installs them. At this stage brew also updates itself.
OK that’s the most useful stuff. Stay on to learn more than you need to know
To uninstall a formula:
brew uninstall <formula>
Brew also auto-installs the dependent files scattered in your Mac’s system folders and removes them when uninstalled.
List all packages installed with Homebrew:
Count the packages (“kegs”):
I have found no command to easily check the versions of all your packages
There is a search feature but why would you want to find a package but not install it? If you attempt to install it first then the worst that can happen is failure, then find a work around. There’s web interface for the package database but you would know the name of the desired package from a tutorial or resource, not browse for it, so it’s a bit pointless. I don’t know how the database is maintained. Maybe it’s now so famous that package devs are queuing up to add theirs to an exclusive list of popular things and it’s their responsibility to inform Homebrew’s maintainer of updates.
Homebrew is mostly built with Git and Ruby. The install command seems to be just a bash ‘curl’ command evaluated by the Ruby REPL, perhaps to check that your system has Ruby installed, which every Mac should. No need to learn Ruby to use it. I have the urge to research every peripheral tool I see. Fight that urge!
- Formula - a package definition written in Ruby e.g. /foo.rb
- Cask - An extension of homebrew to install macOS native apps
- The rest is only worth learning if you need it: Keg, cellar, bottle, tap