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. 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'
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.
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'
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:
- To increase the brightness to the maximum value:
brightness 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.
You should read it
- Instructions to adjust the screen brightness of Android phones
- How to bring Night Shift feature to Mac with F.lux
- Adjust screen brightness of Windows 7 on PC, laptop
- How to adjust the screen brightness of Windows 10 on the desktop
- Manual manual and automatic computer screen brightness adjustment
- Tutorial 4 ways to adjust the screen brightness of Windows 10
- How to adjust the brightness of the Laptop computer screen
- What is Nit when it comes to screen brightness?
- Top software to adjust the best computer screen brightness
- How to adjust the screen brightness on Windows 10 Laptop
- Error not adjusting screen brightness after upgrading Windows 8.1
- What is Nit screen brightness?
Maybe you are interested
How to increase or decrease laptop screen brightness Win 11/10/8/7
Flashlight on iOS 18 has a new focus beam and better brightness control
How to change brightness on Windows 10 for Laptops and PCs
iPhone automatically increases brightness when watching videos, why is that?
3 easy ways to adjust iPhone screen brightness that only takes a few seconds
15 ways to adjust the brightness of computer and laptop screens