Sub topic 18
Homebrew casks as an alternative source
This chapter assumes you can open Terminal and run a command. It also assumes you know the difference between an app, a .dmg and a .pkg, and that you have read the chapters on Gatekeeper and signature verification.
What a cask is
Homebrew is a package manager for macOS. A formula builds command-line tools. A cask installs a macOS app, such as a browser or editor, that normally ships as a .dmg, .zip or .pkg.
A cask is a small text file in a public repository. It lists the vendor's download URL, a SHA-256 checksum, and the steps to install and remove the app. Homebrew downloads the file from the vendor, compares the checksum with the one in the cask, and only then installs the app.
Where it fits in the trust model
A cask does not replace the checks you already know. It moves two of them into a tool.
- Homebrew verifies the checksum for you, so you do not compare hashes by hand.
- The download still comes from the developer's server, so code signing, notarization and Gatekeeper still apply.
- Reviewers of the cask repository check the URL and the checksum. They do not review the app's behavior the way the Mac App Store does.
Homebrew also installs the app without a browser, so a file downloaded this way may not receive the quarantine attribute. Recent Homebrew versions have added quarantine handling and have changed their policy on unsigned casks over time. Check the current Homebrew documentation before you rely on either behavior.
Installing and checking an app
Install Homebrew from the official site, brew.sh, and copy its install command from there. Then read the cask before you install it.
brew info --cask firefox
brew install --cask firefoxbrew info shows the version, the download URL and the homepage. Confirm the homepage is the vendor's official site. Then run the checks from earlier chapters on the installed app.
codesign --verify --deep --strict --verbose=2 /Applications/Firefox.app
spctl --assess --type execute --verbose=4 /Applications/Firefox.appUpdating and removing
Casks use Homebrew's own update commands. Apps that update themselves, such as Firefox, may also update on their own.
brew update
brew outdated --cask
brew upgrade --cask
brew uninstall --cask firefoxAdd --zap to brew uninstall --cask to also remove preferences and caches that the cask lists. Read what it will delete first, because --zap can remove data you want to keep.
Common errors
- Installing a cask from an unofficial third-party tap. A tap is an extra repository of formulas and casks. Prefer the default repositories.
- Assuming a checksum match means the app is safe. It only means the file is unchanged.
- Running
brew installcommands pasted from an untrusted website.
Exercise
Name two checks Homebrew performs or leaves in place when you install a cask, and one thing it does not check.
Show answer
Homebrew compares the download's SHA-256 checksum with the one in the cask. Code signing and Gatekeeper checks still apply to the installed app. It does not review whether the app's behavior is safe, so you still need to trust the vendor.