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.

  • Couldn't you just put the computer (⌥⌘⏏) or display (⌃⇧⏏) to sleep manually?
    – Lri
    Mar 2, 2012 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? Mar 3, 2012 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.)
    – Lri
    Mar 3, 2012 at 9:03

1 Answer 1


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
  • 2
    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
    – Lri
    Mar 2, 2012 at 2:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .