How to adjust screen brightness from Terminal in macOS

Changing the screen brightness on a Mac is easy. All Macs have two dedicated Fn keys designated to reduce or increase screen brightness.

Changing the screen brightness on a Mac is easy. All Macs have two dedicated Fn keys designated to reduce or increase screen brightness. Depending on the type of Mac you use, the keys may vary but they are always present. You can also change the screen brightness from System Preferences by navigating to the Display section and changing the brightness level.

If you're a dedicated Terminal user, you can also choose to change the brightness of your Mac directly from the Terminal. How to do this involves using some simple commands in Terminal.

1. Open Terminal on Mac. You can change the brightness for the Mac directly from the Terminal.

2. To increase the screen brightness on a Mac once (similar to pressing the Increase Brightness button once), enter the following command in Terminal:

 osascript -e 'tell application "System Events"' -e 'key code 144' -e ' end tell' 

How to adjust screen brightness from Terminal in macOS Picture 1

This command will ask you to allow Terminal to control system events on your Mac. If you haven't approved this before, the command will fail automatically and the Terminal will prompt you with the option to open System Preferences and enable Terminal access.

In case the Terminal does not prompt you to do so, you can also manually enable access by navigating to System Preferences> Security and Privacy . From the Privacy tab , enable 'Terminal' in Accessibility.

How to adjust screen brightness from Terminal in macOS Picture 2

Once completed, simply retype the command to increase brightness.

3. Similarly, if you want to lower the brightness, just enter the following command:

 osascript -e 'tell application "System Events"' -e 'key code 145' -e ' end tell' 

How to adjust screen brightness from Terminal in macOS Picture 3

These commands will easily allow you to increase or decrease the screen brightness from the Terminal.

Alternatively, if you have Homebrew installed on the Mac's Terminal, you can use the brightness command to control the screen brightness. If you've never heard of Homebrew before, it's basically a package manager that allows you to install add-on commands for Terminal.

If you already have Homebrew installed, first install 'brightness' into Terminal:

 brew install brightness 

Once completed, simply use the following commands to control the screen brightness:

  1. To increase the brightness to the maximum value:
 brightness 1 
  1. To reduce the screen brightness by 50%:
 brightness 0.5 

Using the above commands, you can easily change your screen brightness directly from within Terminal.

Hope you are succesful.

4 ★ | 47 Vote | 👨 18033 Views
« PREV POST
NEXT POST »