I am looking for a way to hibernate (i.e. RAM saved to HDD then turned off) only when closing the lid. When the lid is opened, I expect OSX to simply turn off the screen after X minutes (i.e. everything keeps running). Mostly what a Windows PC does out of the box.

pmset does not seem to make possible controlling what happens when closing the lid.

  • You mean that the mac should hibernate (write RAM to disk) and not sleep when you close the lid, right?
    – n1000
    Jun 18, 2015 at 18:52
  • Was your question solved?
    – n1000
    Jul 1, 2015 at 15:07
  • @n1000 no, I am in hibernate mode 25, and it behaves exactly as I want in lid-not-closed state but it does not hibernate when closing the lid... I tested playing music: closing the lid does not stop the music. Aug 13, 2015 at 14:04
  • Sorry - I am confused. So it does not sleep at all when the lid is closed? Maybe you want to clarify your question...
    – n1000
    Aug 13, 2015 at 14:06
  • @n1000 done. Yes, it does not hibernate when the lid is closed (the music keeps playing). But at least since I changed the hibernate mode to 25, it behaves as I wanted with the lid opened (only the screen turns off, the network keeps connected, programs keep running, etc.). Aug 13, 2015 at 14:16

1 Answer 1


Hibernate only (not sleep) when closing the lid:

sudo pmset -a hibernatemode 25

And to go back to "normal" behavior:

sudo pmset -a hibernatemode 3

As for the sleep behavior with an open lid, just slide the Computer sleep timer to Neverin System Preferences > Energy Saver. Alternatively do

sudo pmset -a sleep 0

You must log in to answer this question.

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