MacBook: Force hibernation, even on AC power (not battery power)

batteryhibernatemacbook propowersleep-wake

I've found a number of hints to force a MacBook (or other) into Hibernation mode (ie. write RAM to Disk, and completely power off – so system is back in it's pre-sleep state upon next boot), but they all appear to only work when the MacBook is slept while on Battery Power.

Is there a way to force a MacBook Pro to hibernate, even when on AC power (magsafe)?

The reason is: due to a hardware problem, I had to remove the battery from my MacBook (it's got a "Permanent Battery Failure" which was slowing down the whole system presumably due to hardware communication issues, until I removed it – waiting for a replacement). So once the MagSafe AC adapter is unplugged, the system goes down hard – zero power. It loses system time every time I remove the AC power & reboot.

So, while I wait for a new battery to arrive, I would like to make the laptop at least hibernate before I unplug it. So far, trying things like sudo pmset hibernatemode 25 standby 1 standbydelay 0 haven't made this work yet. If I close the laptop or do pmset sleepnow, wait even a few hours and then unplug the AC & then reboot, the system is always starting afresh (no previous state to be restored, and loses system time).

Is this because there is no low-power battery backup (the cause for losing system time), or because the system never went into hibernation? Ie., would a system in hibernate mode, that then lose the system time due to absoluytely zero power, also lose it's hibertaion state? (This doesn't make sense to me, as I'd expect the system to restore from the hard drive.)

FYI, a hibernate file was indeed written, eg.:

>>> ls -fal /var/vm/
-rw------T   1 root  wheel  1073741824 Jul 31 18:31 sleepimage

Perhaps losing system time causes the hibernate file to be skipped?

Thanks for suggestions.
System Specs: MacBook Pro 13-inch late 2011, OS 10.11.6, SSD drive as primary, HDD in-place of DVD drive.

Best Answer

I've used the DeepSleep app for years to put a Late 2012 Mac Mini into hibernation. After "upgrading" from OS X 10.11.5 to 10.11.6 two weeks ago, DeepSleep stopped working. It would only put the computer into normal sleep mode, not hibernation. I spent a few days communicating with the author of DeepSleep and none of his suggestions fixed it, so I reverted the system to 10.11.5 using Time Machine restore and DeepSleep again works. So your problem may simply be that you're running 10.11.6.

I have also tried sudo pmset -a hibernatemode 25 on the command line, as well as sudo pmset -a standby 0 and sudo pmset -a standbydelay 0. None of those have ever made my Mac Mini hibernate when the power button is pressed, even if left overnight, and even on earlier OS X versions. However, those commands are supposed to work on laptops. Since you say they don't, that's more evidence that Apple completely broke hibernation in 10.11.6. However, someone here says they got pmset options to work only after resetting SMC and NVRAM so maybe give that a try.