Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 10 down vote accepted

You can do it via an Applescript and run it as such:

Dimmer:

tell application "System Events"
        key code 107
    end tell

Brighter:

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:

osascript ~/Path/to/File

You can also do it this way, but that requires more setup.

share|improve this answer

You can install this command line tool from github.com/jmstacey/screenbrightness. The install is pretty easy if you have homebrew:

brew install screenbrightness

And usage is straightforward:

  • Set 100% brightness: screenbrightness 1
  • Set 50% brightness: screenbrightness 0.5

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.

share|improve this answer

You can change the volume in terminal with the command

osascript -e 'set volume 7'

Where 7 will set the volume to full.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.