11

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

22

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.
8
  • I get "operation not permitted" deleting the sleep image. – Abhi Beckert Dec 1 '17 at 3:26
  • 1
    @AbhiBeckert - preface it with "sudo" as in the command given in the answer above. – Michael H. Dec 3 '17 at 19:21
  • @khedron I did. I also tried -f with no luck. Since the answer is a couple years old I'm guessing it's simply out of date. Fortunately my sleep image was small, 400MB despite me having 16GB RAM. – Abhi Beckert Dec 8 '17 at 1:19
  • @Abhi Beckert, What version of macOS are you running? – user3439894 Dec 8 '17 at 1:38
  • @AbhiBeckert I see what you mean. It looks like it's because the latest systems have the "System Integrity Protection" feature. You'd have to disable this before using sudo to delete the file. For myself, I guess I'll turn hibernation back on if I can't delete the file; I'd only turned hibernation off while trying to debug sleep issues. forums.macrumors.com/threads/… – Michael H. Jan 11 '18 at 16:58
1

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.

1
  • The accepted answer also works for Mojave and Catalina. Setting hibernatemode to 0 disables hibernation completely; period. Your answer only prevents that a system that has written a hibernate file, yet is still in sleeping state would progress to hibernate state after some time. Yet if hibernate is disabled completely, the system cannot go into hibernate state, no matter how standby is configured. – Mecki Jan 7 at 22:00

You must log in to answer this question.

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