How to tackle waking a stubbornly sleeping Mac

If your Mac takes a long time to wake from sleep and seems to require a reset when it does, here are a few things to try.

Sleep modes in OS X are designed to save power by shutting down unnecessary and power-hungry system components; however, there may be times after an update or other configuration change when the system hangs or otherwise malfunctions after being set to sleep.

OS X has two main sleep modes. The first is standard sleep, in which the system keeps the contents of its memory active by providing power only to the RAM chips. This allows quick wake-up times but also draws a touch more power as it requires uninterrupted power to maintain RAM contents. The second mode is hibernation, in which the system will write RAM contents to disk, after which the entire system can be shut down. This mode requires longer wake-up times as RAM contents are restored, but will save the most energy.

All Mac systems support both sleep modes, though by default desktops are set to use the first, "standard" sleep mode and laptops are set to use the hibernation mode.

These options for setting the sleep modes are stored in the Mac's System Management Controller (SMC), which is the unit responsible for handling hardware during power-related events such as startup and sleep. Hence, if your system is running slowly or hanging during sleep events, then the first step would be to try resetting the SMC or at least checking its values. To do this, open the Terminal utility (in the /Applications/Utilities folder), and run the following command:

Power Management values in OS X
When viewing the power management settings, take note of these 2 variables. Screenshot by Topher Kessler/CNET

pmset -g

In the Terminal's output, check the values of both "hibernatefile" and "hibernatemode." For all systems the hibernatefile should be "/var/vm/sleepimage" by default, and for laptops the hibernatemode should have a value of 3 and for desktops it should be 0. If these values are different, then try resetting your computer's SMC. The instructions for this are different for various systems, so refer to Apple's SMC reset steps.

One situation where systems may appear to hang is if the system is constantly going into full hibernation instead of standard sleep. Even though laptops should be set to use hibernate mode, they should still use standard sleep until battery power gets to critical levels and then wake temporarily to write RAM contents to disk before shutting off. If this always happens regardless of the power level, then when the system wakes you may see a black screen or faded gray view of your desktop that can persist for a few minutes and look like the system is hanging.

If this occurs, then you might try calibrating your battery to hopefully change the power threshold the computer is using to determine when to go to sleep and when to go into hibernation.

The system should only take a few minutes to wake from hibernate mode. However, if it seems to be taking longer and stays in the grayed-out desktop view for extended periods, then you may have a problem with the system's sleep image file used to store RAM contents, and it may help to clear this file out and have the system recreate it from scratch. To do this, open the Terminal and run the following command (provide your password when prompted):

sudo rm /var/vm/sleepimage

Besides the sleep image file and SMC settings used to restore the system from various sleep modes, the operating system also requires proper access to files on the hard drive to wake from sleep. When the system reactivates it will play a level of catch-up with system services as they activate, and use temporary storage locations such as caches to properly resume processes.

As a result, if you find that the system seems to hang when waking from sleep, then you may have a problem with how data is being handled in these caches, so performing a general maintenance routine to clear them out may help. One quick approach is to clear caches used by your user account, which can be done by selecting the Library folder from the Finder's Go menu (hold the Option key to reveal this folder in the menu if it does not appear), and then removing the folder called Caches. This approach will only clear some user caches for applications, so if the hangs still occur then you may want to try clearing all caches using the general maintenance routine mentioned above. This routine will also ensure that file permissions and other settings are at their defaults so the system can properly access needed resources during the wake-up routine.

Questions? Comments? Have a fix? Post them below or e-mail us!
Be sure to check us out on Twitter and the CNET Mac forums.

Featured Video

Huge scientific breakthrough and a big hole in Windows patched

Researchers find a new way to observe the universe. Meanwhile, Microsoft issued an update that fixes a major flaw in Windows.

by Iyaz Akhtar