Skip to content

Instantly share code, notes, and snippets.

@timsutton
Last active August 29, 2015 14:09
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save timsutton/075cdf349106ef1255ff to your computer and use it in GitHub Desktop.
Save timsutton/075cdf349106ef1255ff to your computer and use it in GitHub Desktop.
Script to configure Crash Reporter's Diagnostics Submissions and thereby suppress the dialog displayed in Setup Assistant on 10.10.
#!/bin/sh
#
# This shell snippet will pre-set CrashReporter's setting for diagnostics submissions
# to Apple and app developers. This seems to also have the side effect of not showing
# the additional "Diagnostics & Usage" dialog at the end of the Setup Assistant,
# because the settings have already been configured in the
# DiagnosticMessagesHistory.plist file.
#
# Modify the SUBMIT_TO_* variables below to either YES or NO to configure the setting.
# They are currently set to the defaults suggested by Apple when the dialog is shown
# in Setup Assistant.
#
# Finally, this code is only suitable for a script running _on the booted system_,
# not as part of an installer package postinstall script.
SUBMIT_TO_APPLE=YES
SUBMIT_TO_APP_DEVELOPERS=NO
PlistBuddy="/usr/libexec/PlistBuddy"
os_rev_major=`/usr/bin/sw_vers -productVersion | awk -F "." '{ print $2 }'`
if [ $os_rev_major -ge 10 ]; then
CRASHREPORTER_SUPPORT="/Library/Application Support/CrashReporter"
CRASHREPORTER_DIAG_PLIST="${CRASHREPORTER_SUPPORT}/DiagnosticMessagesHistory.plist"
if [ ! -d "${CRASHREPORTER_SUPPORT}" ]; then
mkdir "${CRASHREPORTER_SUPPORT}"
chmod 775 "${CRASHREPORTER_SUPPORT}"
chown root:admin "${CRASHREPORTER_SUPPORT}"
fi
for key in AutoSubmit AutoSubmitVersion ThirdPartyDataSubmit ThirdPartyDataSubmitVersion; do
$PlistBuddy -c "Delete :$key" "${CRASHREPORTER_DIAG_PLIST}" 2> /dev/null
done
$PlistBuddy -c "Add :AutoSubmit bool ${SUBMIT_TO_APPLE}" "${CRASHREPORTER_DIAG_PLIST}"
$PlistBuddy -c "Add :AutoSubmitVersion integer 4" "${CRASHREPORTER_DIAG_PLIST}"
$PlistBuddy -c "Add :ThirdPartyDataSubmit bool ${SUBMIT_TO_APP_DEVELOPERS}" "${CRASHREPORTER_DIAG_PLIST}"
$PlistBuddy -c "Add :ThirdPartyDataSubmitVersion integer 4" "${CRASHREPORTER_DIAG_PLIST}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment