How to Adjust Screen Brightness from Terminal in macOS

Increase Brightness Terminal Mac Cover

Changing the screen brightness on a Mac is very easy. All Macs have two dedicated Fn keys assigned to decrease / increase the screen brightness. Depending on which Mac you use, the keys may vary but are always present. You can also change the screen brightness from the System Preferences by navigating to the Display section and varying the brightness level.

If you’re a dedicated Terminal user, you can also choose to change the brightness level of your Mac directly from the Terminal. Doing so involves the use of some simple commands in Terminal.

1. Open Terminal on your Mac. You can do this directly from Terminal.

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

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

Increase Brightness Terminal Mac Increase Brightness

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

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

Increase Brightness Terminal Mac System Preferences

Once done, simply enter in the command again to increase the brightness.

3. Similarly, if you’d like to reduce the brightness one notch down, simply enter in the following command:

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

Increase Brightness Terminal Mac Terminal Command

These commands will easily let you increase/decrease the screen brightness from Terminal.

In addition, if you have Homebrew installed on your Mac’s Terminal, you can use the “brightness” command to control your screen brightness. If you haven’t heard of Homebrew before, it’s basically a package manager that lets you install command addons for Terminal.

If you have Homebrew installed, first install “brightness” into Terminal:

brew install brightness

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

To increase the brightness to its maximum value:

brightness 1

To decrease the screen brightness to 50%:

brightness 0.5

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

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Shujaa Imran

Shujaa Imran is MakeTechEasier's resident Mac tutorial writer. He's currently training to follow his other passion become a commercial pilot. You can check his content out on Youtube