For sometime now I have been maintaining Gnu/Linux machines using Saltstack, however I continued to apply updates to our Apple computers manually. Having finally grown tired of this tedious and time consuming manual task I decided to figure out how to update using Salt.
sudo salt -N all-no-a pkg.upgrade is a common command I use to target all my Linux machines and apply all available updates. When I target MacOS machines with a similar command they apply updates available for software installed by the Homebrew Package Manager, which is fine, however I want to apply OS and other updates supplied by Apple as well.
I discovered that using the softwareupdate command will allow me to do this. While this is a command with many options as can be seen below, the options I need to accomplish what I want, are –install, –all and –restart.
One Liner
sudo salt -N apple cmd.run 'softwareupdate --install --all --restart' 2>/dev/null
State
State File
Apply state
Chrls is currently a technology transformation leader at one of the oldest American investment banking services holding companies, headquartered in New York City. Previous roles at current employer include project manager, front office support, retail and enterprise global Windows server support. Currently residing in Tennessee on the Cumberland Plateau and enjoying life, family and open source.