Automate App Installs on the Mac with Homebrew (Premium)

I use the Windows Package Manager (winget) to automate app installs on Windows, but I've got a MacBook Air M3 on the way. And while I knew there were various package managers available for that platform, I wasn't familiar with any of them and was curious if any would support the Mac App Store in the same way that winget supports the Microsoft Store.
It's still early days (for me). And let's get real here, it's not like I'm going to spend as much time on this as I have on winget. But I did hope to perhaps cobble something together before the MacBook Air arrives early next week. So here's what I've found out, and done, so far.
As I vaguely but correctly understood, there are indeed various package managers out there for the Mac, though none are built-in, as with winget in Windows. But one really stood out: Homebrew is routinely cited as the top package manager for macOS, but it also has two added benefits: It works with Linux, too, and it supports the Mac App Store via the mas formula (a package definition).
A quick digression: Homebrew unfortunately uses beer-based terminology well past the point of common sense, so the main command line utility is called brew and it only installs single file command line applications by default. But Homebrew is also extensible via so-called formulae, an archaic plural form of formula—what Americans would call formulas—and you use a special kind of formula, called a cask—yes, the language is tedious—to install more complex native Mac GUI apps.
The mas formula—its name stands for Mac App Store, which is retroactively obvious—has one curious limitation: You can't use it to install a Mac App Store app until you've already installed that app from the Mac App Store using the same Apple ID sign-in. In other words, once you've installed an app from the Store on one Mac, or in some previous install on the same Mac, you can then use Homebrew and mas to later automate the install of that app.
Like winget, Homebrew/mas doesn't really support a simple or sophisticated conditional install in which you (or a script) check for the availability of an app in the Store first and then install it from the web—via a repository—if it can't find it there. So I ended up doing what I did with winget, which is researching which apps are available where and then building app install lists for each source. (On Windows, I very specifically want to install as many apps as possible from the Microsoft Store, and I am doing the same on the Mac though my reasons are less well-defined.)
From a prerequisites standpoint, all you really need is to know (or be able to find) is the command line that installs Homebrew: This is done via the macOS Terminal app, and you'll be asked to supply your sign-in password as this operation requires elevated permissions. If you didn't already install Xcode from the Mac App Store, the Homebrew installer will install the Xcode command line tools as part of the process too.
/bin/bash -c %22$(cu...

Gain unlimited access to Premium articles.

With technology shaping our everyday lives, how could we not dig deeper?

Thurrott Premium delivers an honest and thorough perspective about the technologies we use and rely on everyday. Discover deeper content as a Premium member.

Tagged with

Share post

Please check our Community Guidelines before commenting

Windows Intelligence In Your Inbox

Sign up for our new free newsletter to get three time-saving tips each Friday

"*" indicates required fields

This field is for validation purposes and should be left unchanged.

Thurrott © 2024 Thurrott LLC