So I have been having a problem for the last few days. At night I would close my Macbook and put it to sleep and when I would open it again at work in the morning it would be shutdown and boot from scratch, no wake from sleep, and no hibernate. Anything I was working on yesterday was lost. Well not 100% lost because there is this annoying feature that after a crash, osx will open all the programs and windows that you last had open, but that is another story.
I realized that the problem is that my battery is dead, even though it lights up all the little green lights on the side.
My Battery Condition from the menu icon or from Energy Saver preference pane show ”Replace Now”
Replace Now: The battery is functioning normally but holds significantly less charge than it did when it was new. You can continue to use the battery until you replace it without harming your computer.
And if I unplug my Macbook it shuts down almost immediately.
Set Macbook to hibernate instead of sleeping
So I can’t really get a new battery right now so I need a solution in the meantime.
I rarely work away from a power-supply so that isn’t an issue. What I need is to have my computer hibernate immediately when I close it.
This can be set up using
sudo pmset hibernatemode 25.
From the man page:
hibernatemode = 25 (binary 0001 1001) is only settable via pmset. The system will store a copy of memory to persistent storage (the disk), and will remove power to memory. The system will restore from disk image. If you want “hibernation” - slower sleeps, slower wakes, and better battery life, you should use this setting.
See the man page for more info.