Turn off Macbook automatic hibernation mode?

I'm having a problem with my MacBook Pro (mid 2012) where by when I lock my machine and then return several hours later (at least six hours) it will not respond to me pressing the keyboard.

I have to press the power button and then it boots up requiring a password. Once this password has been entered it takes a few minutes to slowly start all of my processes again (I hear skype logging in behind the blue screen) eventually my bluetooth mouse and keyboard are connected. Finally I can then enter my password to actually gain access to my machine.

This is a problem I've had with OSX since Mavericks was released.

Below is a screenshot of the settings I have tried to change (everything possible) to stop this stupid behaviour and it still persists!

Settings - Screenshot Settings - Screenshot Settings - Screenshot


From a Terminal, use the following command to disable hibernation:

sudo pmset -a hibernatemode 0

If you later want to enable hibernation, use:

sudo pmset -a hibernatemode 3

If you want to free up the disk space used by hibernation, use the following command:

sudo rm /var/vm/sleepimage
  • Note: This file is automatically recreated as needed if hibernation is reenabled and it doesn't already exist.

Updated answer for Mojave and Catalina. You can prevent hibernation mode via this command:

sudo pmset -a standby 0

Source: https://www.howtogeek.com/260478/how-to-choose-when-your-mac-hibernates-or-enters-standby/

You can disable standby mode entirely, if you like. This isn’t necessarily a good idea, as it means a portable MacBook will gradually drain its battery rather than entering a very lower power mode standby mode when you leave it in sleep mode. But it’s your choice.