Idea: when battery runs out of charge turing working, the state of the memory should be saved to hard disk. In former times this was done automatically by the laptop. Laterly it only rebooted and all data were lost.
On Mac OS X you can use pmset
to setup power management behaviour manually. pmset
distinguishes between different modes: „The -a, -b, -c, -u flags determine whether the settings apply to battery ( -b ), charger (wall power) ( -c ), UPS ( -u ) or all ( -a ).“ (pmset man page)
Which features are supported in the current mode can be viewed with pmset -g cap
. So I set hibernatemode in the following way:
sudo pmset -c hibernatemode 3 sudo pmset -b hibernatemode 1
This means depending on the mode (battery or charger) I use different hibernate modes.
hibernatemode takes a bitfield argument defining SafeSleep behavior. Passing 0 disables SafeSleep
altogether, forcing the computer into a regular sleep.
0001 (bit 0) enables hibernation; causes OS X to write memory state to hibernation image at sleep time.
On wake (without bit 1 set) OS X will resume from the hibernation image. Bit 0 set (without bit 1 set)
causes OS X to write memory state and immediately hibernate at sleep time.
0010 (bit 1), in conjunction with bit 0, causes OS X to maintain system state in memory and leave system
power on until battery level drops below a near empty threshold (This enables quicker wakeup from
memory while battery power is available). Upon nearly emptying the battery, OS X shuts off all system
power and hibernates; on wake the system will resume from hibernation image, not from memory.
hibernatemode is set to 3 (binary 0011) by default on supported portables.
hibernatemode is set to 0 (binary 0000) by default on supported desktops.
(pmset man page)
[Update] Found some undocumented features: http://www.radiotope.com/content/os-x-105-leopard-hibernate-options
[Update 2] Apple article about resetting the Power Management Unit (PMU): Resetting MacBook and MacBook Pro System Management Controller (SMC)