mac-brightnessctl is a command line tool for controlling the keyboard backlight brightness on macOS.
mac-brightnessctl [<option>] [<value>]
mac-brightnessctl 0.75 Set brightness to 75%
mac-brightnessctl Get current brightness
mac-brightnessctl -a Get current state of auto-brightness
mac-brightnessctl -a 1 Enable auto-brightness
mac-brightnessctl -s Get current state of suspend idle dimming
mac-brightnessctl -s 1 Suspend idle dimming
mac-brightnessctl -t Get current state of idle dim time
mac-brightnessctl -t 5 Set idle dim time to 5 seconds
mac-brightnessctl -f 5 0.5 [s] Flash the keyboard lights 5 times with an interval of 0.5 seconds and optional fade speed [s].
If [s] is not provided, the default fade speed is 500 milliseconds.
Visual alerts example
ping google.com -c 3 && mac-brightnessctl -f 5 0.5 100 #So, when the ping command is completed successfully, the lights will flash five times with the specified brightness settings.
brew tap rakalex/mac-brightnessctl
brew install mac-brightnessctl
This project was inspired by the work of EthanRDoesMC and their repository KBPulse. I have built upon their ideas and adapted the code to suit the needs of my project.