Remove red (1) notification badge for disabled Catalina upgrade in Mojave #

See update below for important change following Security Update 2020-003 Mojave.

TL;DR: defaults delete com.apple.preferences.softwareupdate LatestMajorOSSeenByUserBundleIdentifier && softwareupdate --list

As of April, half of all macOS users are still running Mojave or earlier (49.01%) rather than Catalina (48.98%). Perhaps not unreasonably:

Most (but intriguingly not all) Mojave users who disable the Catalina upgrade via sudo softwareupdate --ignore "macOS Catalina" are left with a red (1) notification badge on their System Preferences icon in the Dock, even if no updates are available:

A number of solutions have been proposed, including:

Searching for a better way (as well as an answer as to why the issue did not affect all Mojave users who disabled the Catalina upgrade), I had the good fortune of stumbling onto bernuli's October 12 comment, which offered in part:

[T]here is a per user preference file that needs hosing to get rid of notification if software update already ran before you did the ignore.
...
My guess is that new users created after you run the --ignore should never get the Upgrade notification in the first place.

The file in question was identified as ~/Library/Preferences/com.apple.preferences.softwareupdate.plist. I decided to do some testing (TL;DR: bernuli was exactly right):

  1. On a brand new Mojave install, ~/Library/Preferences/com.apple.preferences.softwareupdate.plist did not exist (nor was there a /Library/Preferences/com.apple.preferences.softwareupdate.plist).

  2. Running sudo softwareupdate --ignore "macOS Catalina" on a brand new Mojave install before checking for updates prevented the issue from occurring. ~/Library/Preferences/com.apple.preferences.softwareupdate.plist was created after checking for updates with the following data (which appeared to correspond to "Security Update 2020-002 10.14.6" and "Safari 13.1"):

        <key>ProductKeysLastSeenByUser</key>
        <array>
            <string>061-90745</string>
            <string>061-61260</string>
        </array>
    
  3. Checking for updates on a brand new Mojave install and then running sudo softwareupdate --ignore "macOS Catalina" caused the issue to occur for the current user. ~/Library/Preferences/com.apple.preferences.softwareupdate.plist was populated with:

        <key>LatestMajorOSSeenByUserBundleIdentifier</key>
        <string>com.apple.InstallAssistant.Catalina</string>
        <key>ProductKeysLastSeenByUser</key>
        <array>
            <string>061-90745</string>
            <string>061-61260</string>
        </array>
    
  4. Users created after running sudo softwareupdate --ignore "macOS Catalina" were not affected by the issue; ~/Library/Preferences/com.apple.preferences.softwareupdate.plist did not get created even after such users checked for updates.

In two followup comments, bernuli suggested these steps for disabling Catalina and resolving the red notification badge issue:

  1. Quit System Preferences
  2. sudo softwareupdate --ignore "macOS Catalina"
  3. defaults delete com.apple.preferences.softwareupdate LatestMajorOSSeenByUserBundleIdentifier (deletes the lines containing LatestMajorOSSeenByUserBundleIdentifier and com.apple.InstallAssistant.Catalina from ~/Library/Preferences/com.apple.preferences.softwareupdate.plist)
  4. softwareupdate --list

though based on the above tests, there appears to be little harm in simply deleting ~/Library/Preferences/com.apple.preferences.softwareupdate.plist for step 3 as bernuli originally did then rebooting and checking for updates again. However, using defaults or Prefs Editor is preferable due to the caching system for app preferences (not to mention being faster). As Thomas Tempelmann, the author of Prefs Editor, explains:

Mac OS X 10.8 introduced a caching system for app preferences ("cfprefsd"). While this probably increases performances for apps, it makes it harder for developers to manipulate preference values quickly for testing, because making changes directly to the plist files in the ~/Library/Preferences folder does not work any more with editors such as "Property List Editor.app" and the similar editor in Xcode. As of now (Dec 14, 2013), the only way to edit such preferences is by using the "defaults" command, which is rather difficult to use once it comes to editing dict or array entries.

Therefore, I've written a tool that works like the plist editor in Xcode but uses the CFPreferences functions to modify the values instead of editing the plist files directly.

Tangentially, SwitchUp "allows you to create, duplicate, and switch between multiple profiles of settings (preferences and data) for almost any application." While no longer actively developed, it worked well with Safari and Calculator (but not Contacts) in my testing under Mojave.

UPDATE: After installing Security Update 2020-003 Mojave and Safari 13.1.1, the Catalina nag reappeared in Software Update. ~/Library/Preferences/com.apple.preferences.softwareupdate.plist now contained the following:

        <key>LatestMajorOSSeenByUserBundleIdentifier</key>
        <string>com.apple.InstallAssistant.Catalina</string>
        <key>ProductKeysLastSeenByUser</key>
        <array>
            <string>061-90107</string>
            <string>001-09493</string>
        </array>

Running sudo softwareupdate --ignore "macOS Catalina" returned:

Ignored updates:
(
    "macOS Catalina"
)

Ignoring software updates is deprecated.
The ability to ignore individual updates will be removed in a future release of macOS.

though defaults delete com.apple.preferences.softwareupdate LatestMajorOSSeenByUserBundleIdentifier && softwareupdate --list still works for now to hide the nag again. That is, until the Software Update preference pane is reopened, in which case it needs to be rerun. Jeff Johnson recommends eschewing the preference pane in favor of softwareupdate --list to avoid.

/mac | May 07, 2020


Subscribe or visit the archives.