Skip to main content

I've spent some time researching where these options are actually stored, and found them in all locked away in 



/private/var/root/Library/Preferences/com.apple.CoreBrightness.plist

 

This file is editable by all users, as it simply stores the current display tone and brightness settings. The only trick is, this file is only read at startup, so editing it does require a restart afterwards. For our computers labs and classrooms, we simply run this script at every login. That does mean, however, that if someone changes the display settings, it takes two restarts to get them to go back to our desired default settings (if someone can figure out what service or process to restart to force the preferences to update, that would be great, but for now, this solution is working for us).

 

Update: I have discovered that in order for this to work, you also need to have opened and closed System Settings. I will be working on finding a way around that. For the time being, we have simply added commands to launch System Settings and then restart the computer to our policy, and we only run the policy after hours so that our lab and classroom computers start every day with the correct display settings.

For those who are interested in our solution, here is the script that I wrote up:

#!/bin/bash

##########################################################################################################################################################
#
# Set Display Settings
# Written by KClose
# Created: January 30, 2024
#
# Sets the default Brightness level, Auto Brightness option, and True Tone option.
# The plist is only read upon startup, so changing these settings via this script will not take effect until the first restart after the script is run.
#
##########################################################################################################################################################

### FETCH VARIABLES ###

# 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 "$autoBright" ]] && { $plistPal -c "Set :DisplayPreferences:$displayID:AutoBrightnessEnable $autoBright" "$configRoot"; }
[[ ! -z "$brightLevel" ]] && { $plistPal -c "Set :DisplayPreferences:$displayID:BrightnessLevelNits $brightLevel" "$configRoot"; }

exit 0

unfortunately no.  this mac is running in our jamf sandbox testing server that literally has nothing on it.


Try wiping the test computer and starting over?  I deployed the setting this way to over 300 computers and its working for us.


Thanks Kacey3 for sharing your script! I had been looking for a solution for years (well... since the creation of True Tone). I have rewritten it incorporating all the suggestions and simplified it to my liking. Based on my testing, no reboot or opening of System Settings is required, thanks to PlistBuddy Add and killall cfprefsd.


 


#!/bin/sh

# Written by Kacey Close
# Created: January 30, 2024
# Modified: February 24, 2025

# Set your desired settings here
trueTone="0" # Possible values : 0 or 1
autoBright="false" # Possible values : true or false
brightLevel="" # Between 1 and 600 (values derived from a MacBook Pro 14' M4)

# Fetch Current User
currentUser=$(stat -f %Su /dev/console)

# 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 "Add :CBUser-$userID:CBColorAdaptationEnabled bool $trueTone" "$configRoot"; }
[[ ! -z "$trueTone" ]] && { $plistPal -c "Set :CBUser-$userID:CBColorAdaptationEnabled $trueTone" "$configRoot"; }
[[ ! -z "$autoBright" ]] && { $plistPal -c "Add :DisplayPreferences:$displayID:AutoBrightnessEnable bool $autoBright" "$configRoot"; }
[[ ! -z "$autoBright" ]] && { $plistPal -c "Set :DisplayPreferences:$displayID:AutoBrightnessEnable $autoBright" "$configRoot"; }
[[ ! -z "$brightLevel" ]] && { $plistPal -c "Add :DisplayPreferences:$displayID:BrightnessLevelNits string $brightLevel" "$configRoot"; }
[[ ! -z "$brightLevel" ]] && { $plistPal -c "Set :DisplayPreferences:$displayID:BrightnessLevelNits $brightLevel" "$configRoot"; }

killall corebrightnessd
killall cfprefsd

exit 0

 


 


Thanks Kacey3 for sharing your script! I had been looking for a solution for years (well... since the creation of True Tone). I have rewritten it incorporating all the suggestions and simplified it to my liking. Based on my testing, no reboot or opening of System Settings is required, thanks to PlistBuddy Add and killall cfprefsd.


 


#!/bin/sh

# Written by Kacey Close
# Created: January 30, 2024
# Modified: February 24, 2025

# Set your desired settings here
trueTone="0" # Possible values : 0 or 1
autoBright="false" # Possible values : true or false
brightLevel="" # Between 1 and 600 (values derived from a MacBook Pro 14' M4)

# Fetch Current User
currentUser=$(stat -f %Su /dev/console)

# 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 "Add :CBUser-$userID:CBColorAdaptationEnabled bool $trueTone" "$configRoot"; }
[[ ! -z "$trueTone" ]] && { $plistPal -c "Set :CBUser-$userID:CBColorAdaptationEnabled $trueTone" "$configRoot"; }
[[ ! -z "$autoBright" ]] && { $plistPal -c "Add :DisplayPreferences:$displayID:AutoBrightnessEnable bool $autoBright" "$configRoot"; }
[[ ! -z "$autoBright" ]] && { $plistPal -c "Set :DisplayPreferences:$displayID:AutoBrightnessEnable $autoBright" "$configRoot"; }
[[ ! -z "$brightLevel" ]] && { $plistPal -c "Add :DisplayPreferences:$displayID:BrightnessLevelNits string $brightLevel" "$configRoot"; }
[[ ! -z "$brightLevel" ]] && { $plistPal -c "Set :DisplayPreferences:$displayID:BrightnessLevelNits $brightLevel" "$configRoot"; }

killall corebrightnessd
killall cfprefsd

exit 0

 


 


Thanks for keeping this script alive! I had mothballed it, so it's great to see it still being modified and used, today!