Skip to content

Instantly share code, notes, and snippets.

@smashism
Created August 8, 2024 18:08
Show Gist options
  • Save smashism/08b74f0641418d35dfd444bb8b4227a6 to your computer and use it in GitHub Desktop.
Save smashism/08b74f0641418d35dfd444bb8b4227a6 to your computer and use it in GitHub Desktop.
#!/bin/bash
# determine if current user has opted-in for Apple Intelligence on macOS 15.1 or later
# ekw 2024-08-07
# built at time of macOS 15.1 beta 1
# disclaimer: forward-looking statement… this may not work forever, and likely won't be needed long-term as
# MDM vendors prepare for macOS 15 support.
# this EA for jamf pro is provided as-is with no warranty (express or implied). please test!
currentUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ { print $3 }' )
# global check if there is a user logged in
if [ -z "$currentUser" -o "$currentUser" = "loginwindow" ]; then
echo "no user logged in, cannot proceed"
exit 1
fi
OLDIFS=$IFS
IFS='.' read osvers_major osvers_minor osvers_dot_version <<< "$(/usr/bin/sw_vers -productVersion)"
# restore IFS to previous state
IFS=$OLDIFS
# Check to see if the Mac is reporting itself as running macOS 15
if [[ ${osvers_major} -ge 15 ]]; then
if [ -f "/Users/"$currentUser"/Library/Preferences/com.apple.CloudSubscriptionFeatures.optIn.plist" ] ; then
echo "<result>Yes</result>"
else
echo "<result>No</result>"
fi
exit 0
else
echo "<result>Ineligible</result>"
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment