MacOS – Only hibernate when closing the lid, display sleep otherwise

hibernatemacbook promacospower-management

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.

Best Answer

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