-
-
Save talkingmoose/53a131b2324c0e0945a573dfc3f230f4 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
/usr/bin/defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist AutomaticCheckEnabled -bool TRUE | |
/usr/bin/defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist AutomaticDownload -bool TRUE | |
/usr/bin/defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist AutomaticallyInstallMacOSUpdates -bool TRUE | |
/usr/bin/defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist ConfigDataInstall -bool TRUE | |
/usr/bin/defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist CriticalUpdateInstall -bool TRUE | |
/usr/bin/defaults write /Library/Preferences/com.apple.commerce.plist AutoUpdate -bool TRUE | |
exit 0 |
talkingmoose
commented
Jun 14, 2019
This is something I was looking for to use in Jamf as I am a little new to scripting and Jamf. One question, I see the first 5 lines in your script that I assume control the first check marks in the Software Update preferences. What does the last one set?
/usr/bin/defaults write /Library/Preferences/com.apple.commerce.plist AutoUpdate -bool TRUE
I assume that if I have the first 5 set to false, I pretty much locked down the Mac to not update at all. Trying to completely manage updates with Jamf. I know I can use the defer updates for 90 days option as well. Thank you
The last one for com.apple.commerce is enabling updates for apps from the Mac App Store. It’s equivalent to the “Install app updates from the App Store” option.
Storing related info..to read the settings:
/usr/bin/defaults read /Library/Preferences/com.apple.SoftwareUpdate.plist
returns a report like this...
{
AutomaticCheckEnabled = 1;
AutomaticDownload = 1;
AutomaticallyInstallMacOSUpdates = 1;
ConfigDataInstall = 1;
CriticalUpdateInstall = 1;
LastAttemptBuildVersion = "10.15.4 (19E287)";
LastAttemptSystemVersion = "10.15.4 (19E287)";
LastBackgroundSuccessfulDate = "2020-06-24 13:30:36 +0000";
LastFullSuccessfulDate = "2020-06-25 12:57:23 +0000";
LastRecommendedUpdatesAvailable = 1;
LastResultCode = 0;
LastSessionSuccessful = 1;
LastSuccessfulDate = "2020-06-25 12:57:23 +0000";
LastUpdatesAvailable = 1;
PrimaryLanguages = (
en,
"en-US"
);
RecommendedUpdates = (
{
"Display Name" = "macOS Catalina 10.15.5 Update";
"Display Version" = " ";
Identifier = "macOS Catalina 10.15.5 Update";
"Product Key" = "001-12341";
}
);
SkipLocalCDN = 0;
}
% /usr/bin/defaults read /Library/Preferences/com.apple.SoftwareUpdate.plist AutomaticCheckEnabled
1
Should there be a visual confirmation as well? I'm trying to do the opposite (turning off auto-updates). I type in false instead of true, but when I go back to check under System Preferences > Software Update, the checkmarks are still there. Should the boxes be unchecked after running this script?
@Donathon, just tested on a macOS Monterey 12.4.0 Mac and the script worked as expected.
If you have System Preferences open at the time you run the script, be sure you close and reopen it to refresh. And, yes, you should see all the checkboxes enabled.
I'm running 12.4 and added the script and changed the items to FALSE, but everything is still checked and showing pending updates.
@smr1619 Just tested on macOS 12.4.0 using a Jamf Pro policy and it's working as expected.
Have you tested locally to see if it works? Open Terminal and test individual lines. Then test running the entire script locally. Then see what happens when you add it to whatever management server you're using.
And be sure to close System Preferences completely between tests. Its interface won't automatically update.
Hello, I tested your commands, they work, we can verify it with "defaults read" commands just behind. However, the values, although correctly modified, are not taken into account by the system and the System Settings switches do not move! I think it needs a command behind to force the changes. I tested "Killall Finder" without success. Does anyone have the answer?