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

TL;DR: defaults delete 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/ I decided to do some testing (TL;DR: bernuli was exactly right):

  1. On a brand new Mojave install, ~/Library/Preferences/ did not exist (nor was there a /Library/Preferences/

  2. Running sudo softwareupdate --ignore "macOS Catalina" on a brand new Mojave install before checking for updates prevented the issue from occurring. ~/Library/Preferences/ 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"):

  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/ was populated with:

  4. Users created after running sudo softwareupdate --ignore "macOS Catalina" were not affected by the issue; ~/Library/Preferences/ 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 LatestMajorOSSeenByUserBundleIdentifier (deletes the lines containing LatestMajorOSSeenByUserBundleIdentifier and from ~/Library/Preferences/
  4. softwareupdate --list

though based on the above tests, there appears to be little harm in simply deleting ~/Library/Preferences/ 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" 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.

/mac | May 07, 2020

Subscribe or visit the archives.