Add More SetupAssistant DidSee* & LastSeen* to Avoid All User Setup Screens

Issue #616 resolved
Pico Mitchell created an issue

Here are some other DidSee* prefs that are present in Big Sur, but not in com.twocanoes.mds.main.sh:

DidSeeAccessibility
DidSeeActivationLock
DidSeeAppStore
DidSeeAppearanceSetup
DidSeeApplePaySetup
DidSeeAvatarSetup
DidSeeSyncSetup
DidSeeSyncSetup2
DidSeeTrueTone (THIS ONE APPEARS TO BE SEPERATE FROM DidSeeTrueTonePrivacy)
DidSeeiCloudLoginForStorageServices

Finally, DidSeeScreenTime is present on https://bitbucket.org/twocanoes/macdeploystick/src/a7989eddae93d3339b54e30356da0c6ff13fd795/com.twocanoes.mds.main.sh#lines-263 but is not also listed after https://bitbucket.org/twocanoes/macdeploystick/src/a7989eddae93d3339b54e30356da0c6ff13fd795/com.twocanoes.mds.main.sh#lines-263 as it should be.

Actually finally, Big Sur also lists a LastSeenSiriProductVersion preferences which could be handled the same way that LastSeenCloudProductVersion is in com.twocanoes.mds.main.sh. Interestingly, I am not seeing LastSeenCloudProductVersion in a clean install of Big Sur, but this may still be relevant for older OSes. And for more LastSeen* prefs from my own personal Mac, I have LastSeenDiagnosticsProductVersion, LastSeenSyncProductVersion, andLastSeeniCloudStorageServicesProductVersion which all contain an OS version (not a build number).

Comments (8)

  1. Pico Mitchell reporter

    I went ahead and made my code use the proper keys for all versions of macOS 10.13 and newer. Here are the blocks which replace the key arrays above.

    os_product_version="$(sw_vers -productVersion)"
    os_product_major_version="$(echo "${os_product_version}" | cut -d '.' -f 1)"
    os_product_minor_version="$(echo "${os_product_version}" | cut -d '.' -f 2)"
    
    # The following keys can be retrieved/verified with the command: strings '/System/Library/CoreServices/Setup Assistant.app/Contents/MacOS/Setup Assistant' | grep '^DidSee' | sort
    # These are the keys that are common to all macOS version 10.13 and newer. Other OS version specific keys will be added below.
    setupassistant_did_see_pref_keys=( 'DidSeeApplePaySetup' 'DidSeeAvatarSetup' 'DidSeeCloudSetup' 'DidSeeiCloudLoginForStorageServices' 'DidSeePrivacy' 'DidSeeSiriSetup' 'DidSeeSyncSetup' 'DidSeeSyncSetup2' 'DidSeeTouchIDSetup' )
    
    if (( os_product_major_version == 10 && os_product_minor_version == 13 )); then
        setupassistant_did_see_pref_keys+=( 'DidSeeTrueTonePrivacy' ) # Only exists in 10.13, I believe it was a typo and replaced with "DidSeeTrueTone" in 10.14.
    else
        setupassistant_did_see_pref_keys+=( 'DidSeeAppearanceSetup' 'DidSeeTrueTone' ) # Added in 10.14.
    
        if (( os_product_major_version == 10 && os_product_minor_version >= 15 )) || (( os_product_major_version >= 11 )); then
            setupassistant_did_see_pref_keys+=( 'DidSeeActivationLock' 'DidSeeScreenTime' ) # Added in 10.15.
    
            if (( os_product_major_version >= 11 )); then
                setupassistant_did_see_pref_keys+=( 'DidSeeAccessibility' 'DidSeeAppStore' ) # Added in 11.
            fi
        fi
    fi
    
    # These are the keys that are common to all macOS version 10.13 and newer. Other OS version specific keys will be added below.
    setupassistant_last_seen_pref_keys=( 'LastSeenCloudProductVersion' 'LastSeeniCloudStorageServicesProductVersion' 'LastSeenSyncProductVersion' )
    
    if (( os_product_major_version == 10 && os_product_minor_version >= 15 )) || (( os_product_major_version >= 11 )); then
        setupassistant_last_seen_pref_keys+=( 'LastSeenDiagnosticsProductVersion' 'LastSeenSiriProductVersion' ) # Added in 10.15.
    fi
    

  2. Pico Mitchell reporter

    Awesome! Since yesterday I’ve decided to switch my code to using Darwin major version numbers instead of macOS major and minor version numbers. This allows for much cleaner and easier version comparison for things like this. Using the Darwin major version in MDS could also be a way to fix and avoid bugs like this: https://bitbucket.org/twocanoes/macdeploystick/issues/612/possible-big-sur-version-check-issue

    Here is my latest code for reference:

    darwin_major_version="$(uname -r | cut -d '.' -f 1)" # 17 = 10.13, 18 = 10.14, 19 = 10.15, 20 = 11.0, etc.
    
    # The following keys can be retrieved/verified with the command: strings '/System/Library/CoreServices/Setup Assistant.app/Contents/MacOS/Setup Assistant' | grep '^DidSee' | sort
    # These are the keys that are common to all macOS version 10.13 and newer. Other OS version specific keys will be added below.
    setupassistant_did_see_pref_keys=( 'DidSeeApplePaySetup' 'DidSeeAvatarSetup' 'DidSeeCloudSetup' 'DidSeeiCloudLoginForStorageServices' 'DidSeePrivacy' 'DidSeeSiriSetup' 'DidSeeSyncSetup' 'DidSeeSyncSetup2' 'DidSeeTouchIDSetup' )
    
    if (( darwin_major_version == 17 )); then
        setupassistant_did_see_pref_keys+=( 'DidSeeTrueTonePrivacy' ) # Only exists in macOS 10.13, I believe it was a typo and replaced with "DidSeeTrueTone" in macOS 10.14.
    elif (( darwin_major_version >= 18 )); then
        setupassistant_did_see_pref_keys+=( 'DidSeeAppearanceSetup' 'DidSeeTrueTone' ) # Added in macOS 10.14.
    
        if (( darwin_major_version >= 19 )); then
            setupassistant_did_see_pref_keys+=( 'DidSeeActivationLock' 'DidSeeScreenTime' ) # Added in macOS 10.15.
    
            if (( darwin_major_version >= 20 )); then
                setupassistant_did_see_pref_keys+=( 'DidSeeAccessibility' 'DidSeeAppStore' ) # Added in macOS 11.
            fi
        fi
    fi
    
    for this_setupassistant_did_see_pref_key in "${setupassistant_did_see_pref_keys[@]}"; do
        defaults write "${this_user_home_folder}/Library/Preferences/com.apple.SetupAssistant" "${this_setupassistant_did_see_pref_key}" -bool true
    done
    
    # The following keys can be retrieved/verified with the command: strings '/System/Library/CoreServices/Setup Assistant.app/Contents/MacOS/Setup Assistant' | grep '^LastSeen' | sort
    defaults write "${this_user_home_folder}/Library/Preferences/com.apple.SetupAssistant" LastSeenBuddyBuildVersion -string "$(sw_vers -buildVersion)"
    
    # These are the keys that are common to all macOS version 10.13 and newer. Other OS version specific keys will be added below.
    setupassistant_last_seen_pref_keys=( 'LastSeenCloudProductVersion' 'LastSeeniCloudStorageServicesProductVersion' 'LastSeenSyncProductVersion' )
    
    if (( darwin_major_version >= 19 )); then
        setupassistant_last_seen_pref_keys+=( 'LastSeenDiagnosticsProductVersion' 'LastSeenSiriProductVersion' ) # Added in macOS 10.15.
    fi
    
    os_version="$(sw_vers -productVersion)"
    
    for this_setupassistant_last_seen_pref_key in "${setupassistant_last_seen_pref_keys[@]}"; do
        defaults write "${this_user_home_folder}/Library/Preferences/com.apple.SetupAssistant" "${this_setupassistant_last_seen_pref_key}" -string "${os_version}"
    done
    

  3. timothy perfitt

    works great. I made it into a func at the top of the script so i could call it for the user template and homes:

    #thanks to Pico Mitchell for write_prefs feature
    write_prefs(){
        local folder=$1
    
        if [ -z "${folder}" ];  then
            echo "you must specify a path to write prefs"
            exit -1
        fi
        darwin_major_version="$(uname -r | cut -d '.' -f 1)" # 17 = 10.13, 18 = 10.14, 19 = 10.15, 20 = 11.0, etc.
    
        # The following keys can be retrieved/verified with the command: strings '/System/Library/CoreServices/Setup Assistant.app/Contents/MacOS/Setup Assistant' | grep '^DidSee' | sort
        # These are the keys that are common to all macOS version 10.13 and newer. Other OS version specific keys will be added below.
        setupassistant_did_see_pref_keys=( 'DidSeeApplePaySetup' 'DidSeeAvatarSetup' 'DidSeeCloudSetup' 'DidSeeiCloudLoginForStorageServices' 'DidSeePrivacy' 'DidSeeSiriSetup' 'DidSeeSyncSetup' 'DidSeeSyncSetup2' 'DidSeeTouchIDSetup' )
    
        if (( darwin_major_version == 17 )); then
            setupassistant_did_see_pref_keys+=( 'DidSeeTrueTonePrivacy' ) # Only exists in macOS 10.13, I believe it was a typo and replaced with "DidSeeTrueTone" in macOS 10.14.
        elif (( darwin_major_version >= 18 )); then
            setupassistant_did_see_pref_keys+=( 'DidSeeAppearanceSetup' 'DidSeeTrueTone' ) # Added in macOS 10.14.
    
            if (( darwin_major_version >= 19 )); then
                setupassistant_did_see_pref_keys+=( 'DidSeeActivationLock' 'DidSeeScreenTime' ) # Added in macOS 10.15.
    
                if (( darwin_major_version >= 20 )); then
                    setupassistant_did_see_pref_keys+=( 'DidSeeAccessibility' 'DidSeeAppStore' ) # Added in macOS 11.
                fi
            fi
        fi
    
        for this_setupassistant_did_see_pref_key in "${setupassistant_did_see_pref_keys[@]}"; do
            echo defaults write "${folder}/Library/Preferences/com.apple.SetupAssistant" "${this_setupassistant_did_see_pref_key}" -bool true
        done
    
        # The following keys can be retrieved/verified with the command: strings '/System/Library/CoreServices/Setup Assistant.app/Contents/MacOS/Setup Assistant' | grep '^LastSeen' | sort
        echo defaults write "${folder}/Library/Preferences/com.apple.SetupAssistant" LastSeenBuddyBuildVersion -string "$(sw_vers -buildVersion)"
    
        # These are the keys that are common to all macOS version 10.13 and newer. Other OS version specific keys will be added below.
        setupassistant_last_seen_pref_keys=( 'LastSeenCloudProductVersion' 'LastSeeniCloudStorageServicesProductVersion' 'LastSeenSyncProductVersion' )
    
        if (( darwin_major_version >= 19 )); then
            setupassistant_last_seen_pref_keys+=( 'LastSeenDiagnosticsProductVersion' 'LastSeenSiriProductVersion' ) # Added in macOS 10.15.
        fi
    
        os_version="$(sw_vers -productVersion)"
    
        for this_setupassistant_last_seen_pref_key in "${setupassistant_last_seen_pref_keys[@]}"; do
            echo defaults write "${folder}/Library/Preferences/com.apple.SetupAssistant" "${this_setupassistant_last_seen_pref_key}" -string "${os_version}"
        done
    
    }
    

  4. Pico Mitchell reporter

    Great solution! Not sure all of your use-cases for this, but worth noting that if it's ever planned on being run from within Recovery OS to edit preferences on an installation, uname -r is not available to use for the Darwin major version. In Recovery OS, sw_vers -buildVersion | cut -c -2 | tr -cd '[:digit:]' can be used instead to get the Darwin major version. But also, in that case it would probably be better to pull the OS version from the SystemVersion.plist of the installation rather than the Recovery OS version.

  5. Log in to comment