Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Basically, whenever I know I'm going to be gone, or if I'm going to sleep, I change the Energy Saver settings in System Preferences in OS X (10.7.3) for Power Adapter to:

  • Computer sleep: 1 min
  • Display sleep: 1 min

If I know I'm going to be around a while, I like to change the Energy Saver settings for Power Adapter to:

  • Computer Sleep: 15 min
  • Display Sleep: 15 min

Is it possible to script this sort of change? I do it often enough that a script would be worth it.

share|improve this question
Couldn't you just put the computer (⌥⌘⏏) or display (⌃⇧⏏) to sleep manually? – user495470 Mar 2 '12 at 2:55
@Lri: That also works for me. If you put that down as an answer, I'd upvote it. Is there any way to put both to sleep simultaneously? – Geoff Oxberry Mar 3 '12 at 7:26
Normal sleep should put displays to sleep as well. (If it doesn't on your Mac, you could probably make another question about it.) – user495470 Mar 3 '12 at 9:03
up vote 4 down vote accepted

Look for the section titled "Changing Power Management Settings" in this MacScripter guide. An AppleScript example from the guide:

do shell script "pmset sleep 30" with administrator privileges
share|improve this answer
You can also change the display sleep and store the login password in the script: do shell script "pmset displaysleep 30" password "somepassword" with administrator privileges – user495470 Mar 2 '12 at 2:53

Your Answer


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.