How to hibernate the Mac after sleep after a set time? [duplicate]
Solution 1:
Yes, it has a hibernate option. Apple calls it Safe Sleep
. When you put the Mac to sleep, OS X dumps the RAM onto the disk and goes to normal sleep (like Windows's Standby). When the battery is too weak to hold the RAM in standby, the computer is turned off. Then it's in the mode you call hibernation which is technically called "ACPI mode S4" or "Suspend-To-Disk".
You can force "Suspend-To-Disk" by disabling the standard sleep via SmartSleep or via pmset
on the command line. Its man page has a lot of information on Safe Sleep
.
Solution 2:
When newer laptops are put to sleep, they should save the contents of the RAM to /var/vm/sleepimage
but keep the RAM powered as well. Desktop Macs should just use normal sleep mode by default.
man pmset
:
hibernatemode = 0 (binary 0000) by default on supported desktops. The
system will not back memory up to persistent storage. The system must
wake from the contents of memory; the system will lose context on power
loss. This is, historically, plain old sleep.
hibernatemode = 3 (binary 0011) by default on supported portables. The
system will store a copy of memory to persistent storage (the disk), and
will power memory during sleep. The system will wake from memory, unless
a power loss forces it to restore from disk image.
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.
- 0 (traditional sleep mode): fast wake up and sleep, saves disk space
- 3 (default safe sleep mode): fast wake up and sleep, state is kept when losing power
- 25 (hibernation): saves energy, state is kept when losing power
You can see which mode your Mac uses with pmset -g | grep hibernatemode
and change it with sudo pmset -a hibernatemode $mode
.
Some newer Macs support a standby mode on 10.8 and later. Even if hibernatemode
was set to 3, they power off memory after a bit over an hour of sleep.
Solution 3:
Expanding on Max Ried's answer above, I've been using this free app to enable hibernation on my macs for at least the last 5 years: Hibernate by Patrick Stein. I set it to "hibernate only" mode, and every time I put my mac to "Sleep," it instead skips straight to SafeSleep.
So far I haven't had any issues that I can prove were caused directly by this app; that is to say my computer rarely crashes or hangs, and I repeatedly "Hibernate" it when I need to take my laptop someplace with me (rather than shutting it down) often for weeks at a time without issue.
I should mention that my newest mac is a 4-5 year old MacBook Pro, so I have not tested this app on newer machines.
Solution 4:
Also, the original poster notes that sleeping OS X machines continue to periodically check mail, etc. This is a feature on new-ish machines (it debuted in the 2011 MacBook Air) called PowerNap. In effect, the computer wakes periodically and briefly from sleep in order to handle recurring tasks.
A summary from Apple's http://support.apple.com/kb/HT5394:
While sleeping, Power Nap allows your Mac to do things like periodically check for new mail, calendar, and other iCloud updates. When plugged into AC power, Power Nap can also perform things like Time Machine backups to an AirPort Time Capsule and download OS X software updates while your Mac sleeps.
When your compatible Mac goes to sleep, Power Nap still works to do the following:
- Mail - Receive new messages.
- Contacts - Your Contacts update with any changes you may have made on another device.
- Calendar - Receive new invitations and calendar updates.
- Reminders - Reminders updates with any changes you may have made on another device.
- Notes - Notes updates with any changes you may have made on another device.
- Documents in your iCloud account - iCloud pushes any edits you made to a document to your Mac notebook.
- Photo Stream - Your Photo Stream updates with new photos from your iPhone, iPad, or iPod touch.
- Find My Mac - Locate a lost Mac notebook even when it’s sleeping.
- VPN on demand - Corporate email updates securely.
- Mobile Device Management - Remotely lock and wipe the computer.
Power Nap does more when your Mac is plugged in to an AC outlet:
- Downloads software updates
- Backs up with Time Machine
- Performs Spotlight indexing
- Continues background downloads of Mac App Store items, including software updates
- Updates Help Center content
- Wake on Wireless support for Apple and third party wireless base stations