Is it possible to dim the screen from Terminal, in a Mac with OS X Lion? Is there any command to do control brightness and volume?
You can do it via an Applescript and run it as such:
tell application "System Events" key code 107 end tell
tell application "System Events" key code 113 end tell
You can save these as .script files and then run them from the CLI like this:
You can also do it this way, but that requires more setup.
You can install this command line tool from github.com/nriley/brightness. The install is pretty easy if you have homebrew:
brew install brightness
And usage is straightforward:
- Set 100% brightness:
- Set 50% brightness:
Unfortunately it doesn't work for external monitors. See Does Apple support DDC/CI for 3rd party displays via Apple's Thunderbolt to DVI adapter for background on why.
I've created a node module for this that supports setting the brightness using the CLI. See https://github.com/kevva/brightness-cli.
npm install --global brightness-cli
And then simply just run
brightness from your command line.