Last active
March 7, 2018 06:54
-
-
Save timsutton/9966396 to your computer and use it in GitHub Desktop.
Clear storeagent cache and trigger Mac App Store app updates.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Trigger an update of MAS (and softwareupdate) apps | |
# | |
# This seems to be all that's needed to schedule an immediate update of | |
# MAS apps. This should be run as a normal user. You can run this and | |
# tail the install log to get an idea of what's happening. | |
# | |
# You can also take a look at this user's ~/Library/Caches/com.apple.storagent | |
# directory to get a report on what apps were available, installable, etc. | |
# For example, for about two days after the iWork x.2 updates were released, these | |
# updates were considered "update is too recent" as reported in the | |
# UpdateOperationAudit.plist file. (After about two days they began auto-installing). | |
# This may simply be a cooling-off period that Apple is providing special-case | |
# support for since these are special apps. Not sure there's currently a way to | |
# force these. | |
# | |
# Requirements: | |
# - Mac must have "Install app updates" configured in App Store preferences | |
# - bool "AutoUpdate" in /Library/Preferences/com.apple.storeagent | |
# - This pref doesn't seem to take if set at the user level. I instead | |
# get the Notification Center prompt that new updates are available | |
# and Would I like to install them. | |
# - Mac must be running 10.9 | |
# | |
# Assumptions (by me, so far at least): | |
# - User must be signed into the App Store | |
# - User must be logged in | |
# | |
# What would be nice: | |
# - Some way to easily determine that an update run completed, possibly | |
# by reading a cache plist to compare times. | |
# - A way to force "too recent" updates. | |
# | |
# Other relevant bits that don't seem to need to be touched: | |
# /System/Library/LaunchAgents/com.apple.storeagent.plist | |
# ~/Library/Caches/com.apple.storeagent | |
# ~/Library/Caches/storeagent | |
# clear some datestamps, probably not all of these are needed | |
defaults delete com.apple.storeagent AppUpdatesToInstallLater | |
defaults delete com.apple.storeagent AutoUpdateStartedTimestamp | |
defaults delete com.apple.storeagent AvailableUpdatesAtLastNotification | |
defaults delete com.apple.storeagent ISLastUpdatesQueueCheck | |
defaults delete com.apple.storeagent LastAutoUpdateInvocation | |
defaults delete com.apple.storeagent NextClientIDPingDate | |
defaults delete com.apple.storeagent UserNotificationDate | |
# schedule the actual update | |
/System/Library/PrivateFrameworks/CommerceKit.framework/Versions/A/Resources/appstoreupdateagent -now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment