How to disable Macbook keyboard backlight

8,531

Solution 1

Make the keyboard backlight device writable by everyone:

sudo chmod 777 /sys/class/leds/smc::kbd_backlight/brightness

Then, in your ~/.bash_aliases, add:

echo 0 | tee -a /sys/class/leds/smc::kbd_backlight/brightness

Alternatively, if you want the backlight to be disabled for all users, then add that line instead to /etc/profile.d/custom.sh.

The only caveat I've noticed is that unlocking your screen occassionally appears to reset the backlight to full brightness. Unfortunately, I don't know what's causing this.

Solution 2

(I know this is pertaining to ubuntu but thought it might be helpful to those running Mint as well)

Trying to add these to the bash aliases didn't work for me on Linux Mint running on a Macbook Air 2012 (probably doing something wrong).

I had to run a script as sudo at login

echo '2' > /sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0/brightness
echo '0' > /sys/devices/platform/applesmc.768/leds/smc::kbd_backlight/brightness
exit 0


See: how to run script as sudo at login

  1. I created a shell script in ~/subfolder/script.sh with the script from above.

  2. Then had to edit the sudoers file and enable the custom script to run without a password.

    username ALL=NOPASSWD:/full/path/to/script.sh
    
    # Replace username and path with your own
    
  3. Then basically just added

    sudo /full/path/to/script.sh
    

    to startup applications.

This is explained in the link.

Any suggestions for improvement would be appreciated, but this works for me.

Share:
8,531
Cerin
Author by

Cerin

Updated on September 18, 2022

Comments

  • Cerin
    Cerin over 1 year

    How do I disable the keyboard backlight, by turning it completely off, on a Macbook in 12.04?

    Whenever I reboot, Ubuntu sets the backlight to 100% brightness, and frustratingly the new function keys no longer support being held down, so I have to press the dim key about 50 times to turn off the backlight.

  • Waldir Leoncio
    Waldir Leoncio over 9 years
    Does this disable the keyboard backlight or just set it to a default of 0 (so the user can actually raise it on occasion)?
  • Cerin
    Cerin over 9 years
    The later. The user can still change it, by either using the brightness keys (assuming the mapping is correct) or using the command above but changing the 0 to a value between [0:255].