Tap Homebrew to easily install and upgrade your own apps

The package manager I use on macOS is Homebrew, Brew for short. This is a great open source tool for installing command-line apps and utilities, and keeping them up to date. It’s essentially the Mac version of the Raspberry Pi’s apt. So much of the software I use on a regular basis — the nano text editor, Node.js, Python 3, the shellcheck shell script linter, the hugo website builder, the sass CSS wrangler and a whole load more — were added and are maintained using Brew.

Provide your own apps through Homebrew

I thought it would be fun to distribute my own apps through Brew. Brew has a component called Cask which is used to distribute full apps and binary files that, unlike Brew Formulae such as those listed above, are not compiled from source when they’re installed. The Cask system is an ideal mechanism for power users to install GUI Mac apps and keep up with new releases.

Alas, my apps are insufficiently famous to be allowed into Homebrew’s primary Cask list, so I had no choice but to set up my own list. A list of Formulae and/or Casks is called a Tap in Brew jargon. Taps are really easy to set up: they’re just dedicated GitHub repositories. Here’s how you set up a new Tap:

  • Create a new GitHub repo.
  • Add directories called Formula and Casks.
  • Into each of these you add Ruby files which contain all the information Brew needs to download, authenticate and install the Tap’s apps.

Here’s my Tap: https://github.com/smittytone/homebrew-smittytone. Take a look at the contents of the Casks directory for examples, but here’s one:

cask "ascii" do
  version "1.2.1"
  sha256 "89be94a18c507f2cf7f8e6e627d8f2ed16dff6b236437585aa2af04ef4cc2698"
  url "https://www.smittytone.net/files/ascii/ascii_1_2_1.dmg"
  name "Ascii"
  desc "A tool to generate glyphs for 8x8 LED matrix displays"
  homepage "https://www.smittytone.net/ascii/index.html"
  pkg "ASCII.pkg"

  uninstall pkgutil: [

Most of the various .rb files’ contents are self-explanatory. The important keys are binary, app and pkg which, respectively, tell Homebrew the app is a CLI tool to be be made accessible in /usr/local/bin, is an app that should be added to the main Applications folder, or is installed using the named .pkg file. Apps installed from a .pkg file also need to include a mechanism by which Homebrew can uninstall them. That’s not required for the other modes; removing an app just involves deleting it from known folders.

With you Tap set up and Casks and/or Formulae added, your users can then enter brew tap <your_tap_repo_name> which sets up their local Brew installation to look their for apps to install and for updates to existing apps.

Updates and new apps are displayed when you next run brew update.

You install apps with a simple brew install <formula_name> or brew cask install <cask_name>, depending on the type of app you want to install. They are listed by type when you do brew update.

The upshot is that, once you have an app installed, you can periodically call brew update and then brew upgrade to install app updates. This saves manually checking for new versions and hopping over to websites to download, and then install, new versions.

Because Homebrew runs from the command line, it’s scriptable, which means it’s easy to add to, for example, new Mac setup scripts.

To use my Tap, just enter:

brew tap smittytone/homebrew-smittytone

That done, you can install my apps:

brew cask install mnu
brew cask install pdfmaker
brew cask install ascii
brew cask install the-valley

When updates are flagged, just use (for example):

brew upgrade --cask mnu

It’s just as easy as attempting to get into the main Homebrew repo and, as Groucho Marx once pointed out, I wouldn’t want to join any club that would have me as a member…