System Preferences -> Security & Privacy -> Privacy -> Advertising
Does anyone know of a way to enable this via plist or conf profile?
System Preferences -> Security & Privacy -> Privacy -> Advertising
Does anyone know of a way to enable this via plist or conf profile?
Best answer by MrP
When I first opened my privacy panel, I saw what @michael.madsen reported. However after running again I am unable to reproduce. I suspect there is something in the adprivacyd that is writing the last setting in memory to the files on a timer. This isn't much better, but at least if it doesn't stick, it will keep trying for up to 20 retries until it does, and if it does not, report an error. A much cleaner solution like a CP would be much preferred.
Edit: Upon further testing I was able to see this loop twice before the setting took, so it looks like it is sporadically required to make multiple attempts.
#!/bin/bash
user=`ls -l /dev/console | cut -d " " -f 4`
##
# Ad Tracking: Limit Ad Tracking
##
count=0
a=`defaults read /Users/$user/Library/Preferences/com.apple.AdLib forceLimitAdTracking `
while [[ "$a" == "0" && $count < 20 ]]; do
let "count += 1"
echo "User: Ad Tracking: Enabling 'Limit Ad Tracking' in 'Security & Privacy'"
sudo -u $user defaults write /Users/$user/Library/Preferences/ByHost/com.apple.preference.security.privacy limitAdTrackingCached -int 0
sudo -u $user defaults write /Users/$user/Library/Preferences/com.apple.AdLib forceLimitAdTracking -int 1
sudo -u $user defaults write /Users/$user/Library/Preferences/com.apple.AdLib "AD_DEVICE_IDFA" -string "00000000-0000-0000-0000-000000000000"
sleep 1
killall adprivacyd
killall -SIGHUP cfprefsd
sleep 5
a=`defaults read /Users/$user/Library/Preferences/com.apple.AdLib forceLimitAdTracking `
done
if [ "$a" == "0" ]; then echo Setting could not be applied; exit 1; fiEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.