Home > Mac administration, Mac OS X, macOS, Scripting > Enabling automatic macOS software updates for OS X Yosemite through macOS Mojave

Enabling automatic macOS software updates for OS X Yosemite through macOS Mojave

A while back, I wrote a post on how to enable automatic OS X updates on OS X Yosemite. The methods used to enable automatic macOS updates changed as of macOS Mojave, so let’s take a look at the changes. For more details, please see below the jump.

The main change is that the option to enable automatic macOS updates has moved from the com.apple.commerce preference domain to the com.apple.SoftwareUpdate preference domain. On OS X Yosemite through macOS High Sierra, the following command can be run with root privileges to enable OS X and macOS updates to be installed automatically:

defaults write /Library/Preferences/com.apple.commerce AutoUpdateRestartRequired -bool true

Screen Shot 2018-12-28 at 4.45.06 PM

When this command is run, the following checkbox should be checked in the App Store preferences in System Preferences.

For Yosemite and El Capitan:

  • Install OS X updates

Screen Shot 2018 12 28 at 5 19 38 PM

For Sierra and High Sierra:

  • Install macOS updates

Screen Shot 2018 12 28 at 4 44 02 PM

As of macOS Mojave, the following command can be run with root privileges to enable macOS updates to be installed automatically:

defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticallyInstallMacOSUpdates -bool true

Screen Shot 2018-12-28 at 3.56.42 PM

When this command is run, the following checkbox should be checked in the Software Update preferences in System Preferences.

  • Install macOS updates

Screen Shot 2018 12 28 at 3 56 59 PM

In both cases, the Mac will check for new updates overnight and install them when the Mac is idle. If a reboot is needed as part of installing an update, the Mac will reboot automatically.

If the Mac is not idle and a reboot is needed, a notification will appear to the logged-in user asking permission to reboot.

On OS X Yosemite through macOS High Sierra, the notification should look similar to this:

Screen Shot 2018 01 10 at 10 20 47 AM

On macOS Mojave, the notification should look similar to this:

MacOS Mojave Software Update 003

Unfortunately, it is not yet possible to set these automatic update settings using a profile. The com.apple.commerce preference domain can’t be managed by a profile and the AutomaticallyInstallMacOSUpdates setting in the com.apple.SoftwareUpdate preference domain should be manageable with a profile, but for unknown reasons, it can’t be.

In place of a profile, I’ve written a script to set up automatic OS X / macOS updates for OS X Yosemite through macOS Mojave. This script enables the following options:

  • Automatic background check for macOS software updates
  • Automatic download of macOS software updates
  • Automatic download and installation of XProtect, MRT and Gatekeeper updates
  • Automatic download and installation of automatic security updates
  • Automatic installation of OS X / macOS updates for OS X Yosemite through macOS Mojave

The script is available below and also on GitHub at the following address:

https://github.com/rtrouton/rtrouton_scripts/tree/master/rtrouton_scripts/enable_automatic_apple_software_updates

  1. January 6, 2019 at 12:25 am

    I’ve always disabled this bc I thought automatic updates required elevated rights? Is this not correct?

    Thanks,
    R

  2. Peter Trondsen
    January 10, 2019 at 2:01 pm

    Is there a way to do this for Security and regular updates, but not OS Revisions. For example block going from High Sierra to Mojave?

  3. January 14, 2019 at 3:49 pm

    Any idea how enable the app store app updates via script? There doesn’t seem to be a key for it in the /Library/Preferences/com.apple.SoftwareUpdate.plist

  4. April 10, 2019 at 2:58 pm

    Just some data points:
    1 week after 10.14.4 came out, we saw about ~18% of our 10.14 computers running 10.14.4.
    2.5 weeks after 10.14.4 came out, we saw about ~41% of our 10.14 computers running 10.14.4.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: