Hi there, does this work on ipads?
Thanks
Hi there, does this work on ipads?
Thanks
Unfortunately, this is for MacOS only. Scripting is not an option for iOS devices.
Upon further testing, while this worked flawlessly on my test system, it seems like it is inconsistent at best in practice. I will continue to work on this at my leisure, but Apple is not making this an easy thing to enforce.
This is useful. Thanks. I found the same plist because I needed Auto Brightness to be off due to our colour-calibrated computer labs. (True Tone as well, but almost no one is working here that late.) Because setting the brightness value has been the biggest improvement we are looking at (returning it to the value at calibration time), we are testing "brightness" (https://github.com/nriley/brightness) and Outset to reset the brightness at login time. It uses APIs, which means the change happens immediately upon run.
I'm presuming the reason `defaults write` isn't being used here is because we don't know the display ID.
This is useful. Thanks. I found the same plist because I needed Auto Brightness to be off due to our colour-calibrated computer labs. (True Tone as well, but almost no one is working here that late.) Because setting the brightness value has been the biggest improvement we are looking at (returning it to the value at calibration time), we are testing "brightness" (https://github.com/nriley/brightness) and Outset to reset the brightness at login time. It uses APIs, which means the change happens immediately upon run.
I'm presuming the reason `defaults write` isn't being used here is because we don't know the display ID.
"Defaults Write" could be used, I'm sure, but I am a fan of PlistBuddy, so I tend to start there unless there's something I can't do with it. You would still need to use a "Defaults Read" (or some similar method) to find the correct Display ID. Otherwise, in my experience, PlistBuddy and Defaults are fairly interchangable.
I get an error "Set: Entry, ":CBUser-C02B2E82-A6D5-463F-8001-EAC91E5D406C:CBColorAdaptationEnabled", Does Not Exist" when trying to set the True Tone (only). Any ideas?
I get an error "Set: Entry, ":CBUser-C02B2E82-A6D5-463F-8001-EAC91E5D406C:CBColorAdaptationEnabled", Does Not Exist" when trying to set the True Tone (only). Any ideas?
I'm honestly not sure. Because the "primary" display seems to receive a random ID, I can't be sure. It took a lot of work to source out all of the files and IDs, and honestly it still never worked quite right.
I'm honestly not sure. Because the "primary" display seems to receive a random ID, I can't be sure. It took a lot of work to source out all of the files and IDs, and honestly it still never worked quite right.
Thanks, I THINK I figured it out. I've never used PlistBuddy so it took me a while to decipher what you wrote. It seems the CBColorAdatationEnable key doesn't exist in the plist until it's changed so modified through the GUI:
[[ ! -z "$trueTone" ]] && {
$plistPal -c "Add :CBUser-$userID:CBColorAdaptationEnabled integer $trueTone" "$configRoot" 2>/dev/null;
$plistPal -c "Set :CBUser-$userID:CBColorAdaptationEnabled $trueTone" "$configRoot"; }
A reboot is required to get the setting to take... I'm sure there's a process that can be killed instead of a reboot but to be honest I'm not that bright to figure these things out.
Thanks, I THINK I figured it out. I've never used PlistBuddy so it took me a while to decipher what you wrote. It seems the CBColorAdatationEnable key doesn't exist in the plist until it's changed so modified through the GUI:
[[ ! -z "$trueTone" ]] && {
$plistPal -c "Add :CBUser-$userID:CBColorAdaptationEnabled integer $trueTone" "$configRoot" 2>/dev/null;
$plistPal -c "Set :CBUser-$userID:CBColorAdaptationEnabled $trueTone" "$configRoot"; }
A reboot is required to get the setting to take... I'm sure there's a process that can be killed instead of a reboot but to be honest I'm not that bright to figure these things out.
Ah yes. You definitely have to use ADD or SET depending on whether the value exists first or not.I will frequently wipe out an entire plist and then I can use ADD for everything, but that didn't work in this scenario.
As for killing processes, I killed a *lot* of processes trying to aim for the correct one and never found it, so I had to use the reboot to get it to take.
Thanks, I THINK I figured it out. I've never used PlistBuddy so it took me a while to decipher what you wrote. It seems the CBColorAdatationEnable key doesn't exist in the plist until it's changed so modified through the GUI:
[[ ! -z "$trueTone" ]] && {
$plistPal -c "Add :CBUser-$userID:CBColorAdaptationEnabled integer $trueTone" "$configRoot" 2>/dev/null;
$plistPal -c "Set :CBUser-$userID:CBColorAdaptationEnabled $trueTone" "$configRoot"; }
A reboot is required to get the setting to take... I'm sure there's a process that can be killed instead of a reboot but to be honest I'm not that bright to figure these things out.
[[ ! -z "$trueTone" ]] && {
if ! $plistPal -c "Print :CBUser-$userID:CBColorAdaptationEnabled" "$configRoot" 2>/dev/null; then
$plistPal -c "Add :CBUser-$userID:CBColorAdaptationEnabled integer 0" "$configRoot";
else
$plistPal -c "Set :CBUser-$userID:CBColorAdaptationEnabled $trueTone" "$configRoot";
fi
}
Ah yes. You definitely have to use ADD or SET depending on whether the value exists first or not.I will frequently wipe out an entire plist and then I can use ADD for everything, but that didn't work in this scenario.
As for killing processes, I killed a *lot* of processes trying to aim for the correct one and never found it, so I had to use the reboot to get it to take.
Did some more digging:
1. A log out will do
2. sudo killall corebrightnessd and sudo killall WindowServer
@kacey3 What do you set the empty variables to at the beginning of your script
# Set empty variables
trueTone=""
autoBright=""
brightLevel=""
@kacey3 What do you set the empty variables to at the beginning of your script
# Set empty variables
trueTone=""
autoBright=""
brightLevel=""
These are intentionally empty and are not intended to be filled. These same variables will be set by parameters, but if a certain parameter is not set, we still need an empty variable later in the script.
These are intentionally empty and are not intended to be filled. These same variables will be set by parameters, but if a certain parameter is not set, we still need an empty variable later in the script.
Thanj you. Everytime I run it manually for testing I get the following results and nothign changes
True Tone option will not be changed.
Auto Brightness option will not be changed.
Brightness Level will not be changed.
Thanj you. Everytime I run it manually for testing I get the following results and nothign changes
True Tone option will not be changed.
Auto Brightness option will not be changed.
Brightness Level will not be changed.
Are you setting the parameters in the script in the policy?

Are you setting the parameters in the script in the policy?

duh!!! thanks. that was it. however the when running the script, the settings change for a split second then revert, even when killing the corebrightnessd and Windowserver processors. Any thoughts on that?
This is the script result
duh!!! thanks. that was it. however the when running the script, the settings change for a split second then revert, even when killing the corebrightnessd and Windowserver processors. Any thoughts on that?
I found that it only ever worked after a full restart... and even then, it was inconsistent at best. I mostly used it for setting the options once, but then they never really stuck if someone changed them manually later.
Sorry I couldn't be of more help. This is one of those projects that I put a lot of effort into, and then was kind of defeated by Apple in general.
I found that it only ever worked after a full restart... and even then, it was inconsistent at best. I mostly used it for setting the options once, but then they never really stuck if someone changed them manually later.
Sorry I couldn't be of more help. This is one of those projects that I put a lot of effort into, and then was kind of defeated by Apple in general.
Understood. thank you. by chance did you see the screenshot I posted with the error message?

Understood. thank you. by chance did you see the screenshot I posted with the error message?

This was my final script based on @kacey3 's work which is working for me. I only use it to turn off TrueTone:
#!/bin/bash
# Set empty variables
trueTone=""
autoBright=""
brightLevel=""
# Fetch True Tone option.
if [[ $4 == [Nn] ]]; then
echo "True Tone will be disabled."
trueTone="0"
elif [[ $4 == [Yy] ]]; then
echo "True Tone will be enabled."
trueTone="1"
else
echo "True Tone option will not be changed."
fi
# Fetch Auto Brightness option.
if [[ $5 == [Nn] ]]; then
echo "Auto Brightness will be disabled."
autoBright="false"
elif [[ $5 == [Yy] ]]; then
echo "Auto Brightness will be enabled."
autoBright="true"
else
echo "Auto Brightness option will not be changed."
fi
# Fetch Brightness Level
# The recomended value at the time this script was written is a real number between 3 and 525.
# This value was derived from an M1 iMac.
[[ -z "$6" ]] && { echo "Brightness Level will not be changed."; } || { brightLevel="$6"; echo "Brightness Level will be set to $brightLevel"; }
# Fetch Current User
currentUser=$(echo "show State:/Users/ConsoleUser" | scutil | awk '/Name

{ print $3 }')
# Fetch GUID of Current User
userID=$(dscl . -read /Users/$currentUser/ GeneratedUID | awk -F': ' '{print $2}')
# Shortcut the PlistBuddy command for convnience.
plistPal="/usr/libexec/PlistBuddy"
# Define the Configuration File locations.
configRoot="/private/var/root/Library/Preferences/com.apple.CoreBrightness.plist"
# Fetch ID of Primary Display
displayID=$($plistPal -c "Print :DisplayPreferences:" "$configRoot" | grep "= Dict" | grep -v AutoBrightnessCurve | awk '{print $1}')
### MAIN SCRIPT ###
# Set options in the root Plist
#[[ ! -z "$trueTone" ]] && { $plistPal -c "Set :CBUser-$userID:CBColorAdaptationEnabled $trueTone" "$configRoot"; }
#[[ ! -z "$trueTone" ]] && {
# $plistPal -c "Add :CBUser-$userID:CBColorAdaptationEnabled integer $trueTone" "$configRoot" 2>/dev/null;
# $plistPal -c "Set :CBUser-$userID:CBColorAdaptationEnabled $trueTone" "$configRoot"; }
[[ ! -z "$trueTone" ]] && {
if ! $plistPal -c "Print :CBUser-$userID:CBColorAdaptationEnabled" "$configRoot" 2>/dev/null; then
$plistPal -c "Add :CBUser-$userID:CBColorAdaptationEnabled integer 0" "$configRoot";
else
$plistPal -c "Set :CBUser-$userID:CBColorAdaptationEnabled $trueTone" "$configRoot";
fi }
[[ ! -z "$autoBright" ]] && { $plistPal -c "Set :DisplayPreferences:$displayID:AutoBrightnessEnable $autoBright" "$configRoot"; }
[[ ! -z "$brightLevel" ]] && { $plistPal -c "Set :DisplayPreferences:$displayID:BrightnessLevelNits $brightLevel" "$configRoot"; }
killall corebrightnessd
killall WindowServer
exit 0
This was my final script based on @kacey3 's work which is working for me. I only use it to turn off TrueTone:
#!/bin/bash
# Set empty variables
trueTone=""
autoBright=""
brightLevel=""
# Fetch True Tone option.
if [[ $4 == [Nn] ]]; then
echo "True Tone will be disabled."
trueTone="0"
elif [[ $4 == [Yy] ]]; then
echo "True Tone will be enabled."
trueTone="1"
else
echo "True Tone option will not be changed."
fi
# Fetch Auto Brightness option.
if [[ $5 == [Nn] ]]; then
echo "Auto Brightness will be disabled."
autoBright="false"
elif [[ $5 == [Yy] ]]; then
echo "Auto Brightness will be enabled."
autoBright="true"
else
echo "Auto Brightness option will not be changed."
fi
# Fetch Brightness Level
# The recomended value at the time this script was written is a real number between 3 and 525.
# This value was derived from an M1 iMac.
[[ -z "$6" ]] && { echo "Brightness Level will not be changed."; } || { brightLevel="$6"; echo "Brightness Level will be set to $brightLevel"; }
# Fetch Current User
currentUser=$(echo "show State:/Users/ConsoleUser" | scutil | awk '/Name

{ print $3 }')
# Fetch GUID of Current User
userID=$(dscl . -read /Users/$currentUser/ GeneratedUID | awk -F': ' '{print $2}')
# Shortcut the PlistBuddy command for convnience.
plistPal="/usr/libexec/PlistBuddy"
# Define the Configuration File locations.
configRoot="/private/var/root/Library/Preferences/com.apple.CoreBrightness.plist"
# Fetch ID of Primary Display
displayID=$($plistPal -c "Print :DisplayPreferences:" "$configRoot" | grep "= Dict" | grep -v AutoBrightnessCurve | awk '{print $1}')
### MAIN SCRIPT ###
# Set options in the root Plist
#[[ ! -z "$trueTone" ]] && { $plistPal -c "Set :CBUser-$userID:CBColorAdaptationEnabled $trueTone" "$configRoot"; }
#[[ ! -z "$trueTone" ]] && {
# $plistPal -c "Add :CBUser-$userID:CBColorAdaptationEnabled integer $trueTone" "$configRoot" 2>/dev/null;
# $plistPal -c "Set :CBUser-$userID:CBColorAdaptationEnabled $trueTone" "$configRoot"; }
[[ ! -z "$trueTone" ]] && {
if ! $plistPal -c "Print :CBUser-$userID:CBColorAdaptationEnabled" "$configRoot" 2>/dev/null; then
$plistPal -c "Add :CBUser-$userID:CBColorAdaptationEnabled integer 0" "$configRoot";
else
$plistPal -c "Set :CBUser-$userID:CBColorAdaptationEnabled $trueTone" "$configRoot";
fi }
[[ ! -z "$autoBright" ]] && { $plistPal -c "Set :DisplayPreferences:$displayID:AutoBrightnessEnable $autoBright" "$configRoot"; }
[[ ! -z "$brightLevel" ]] && { $plistPal -c "Set :DisplayPreferences:$displayID:BrightnessLevelNits $brightLevel" "$configRoot"; }
killall corebrightnessd
killall WindowServer
exit 0
Thank you. unforntuately I cannot get it to work. it disables true tone, the screen color changes, but then in a couple seconds reverts back.
Thank you. unforntuately I cannot get it to work. it disables true tone, the screen color changes, but then in a couple seconds reverts back.
And you're using the script parameters?
And you're using the script parameter?
And you're using the script parameters?
And you're using the script parameter?
Yep..same as the screenshot above that @kacey3 posted.
Truetone gets disabled and the screen color changes, then after about 3-4 seconds it slowly reverts back to the "yellow" true tone color.
Yep..same as the screenshot above that @kacey3 posted.
Truetone gets disabled and the screen color changes, then after about 3-4 seconds it slowly reverts back to the "yellow" true tone color.
Maybe you have another policy (from your testing) or config profile that's changing things back?
Maybe you have another policy (from your testing) or config profile that's changing things back?
unfortunately no. this mac is running in our jamf sandbox testing server that literally has nothing on it.