Troubleshooting system sleep in OS X

It usually only takes a few seconds for a Mac to wake from or go to sleep, but sometimes problems can result in this process taking a long time.

Generally it only takes a few seconds for a Mac to wake from or go to sleep, but there may be times when it either takes an exceptionally long time or when it will not wake or sleep at all.

If the system takes a long time to wake from sleep, it may be that it is just waking from a deep sleep mode. The computer's RAM cannot store data without power, so in standard sleep modes, RAM is kept active while the majority of the rest of the system is powered off. This allows for quick sleep and wake events; however, in situations where power is not continuous (such as a laptop with low batteries), the system will switch to a hibernate mode where it writes the RAM contents to the hard drive and shuts off.

When the system is subsequently woken from hibernation, it will take a little time for the RAM contents to be loaded from the hard drive back into RAM, which may be one reason a system may take a little longer than expected to wake up. On Mac systems you may see a progress bar at the bottom of the display when this happens, but this is not always the case and displays may appear black or darkened.

If the system takes more than a few minutes to wake from sleep, then it suggests a problem, in which case there are some possible routes to take:

  1. Disconnect or disable peripherals
    The first step to take when troubleshooting sleep problems is to remove peripheral devices. These include both those that are directly attached to the system (i.e., hard drives, printers, and scanners) in addition to those that are associated with the system wirelessly (i.e., keyboards and mice). Some people have claimed that devices such as Apple's Magic Trackpad have prevented systems from waking up properly, so one option is to turn off these devices to see if having them off allows the system to wake faster.

    In addition to the possibility of preventing systems from waking, peripheral devices are usually the root of problems where systems cannot be put to sleep in the first place. If you set your system to sleep and it immediately wakens, then disconnecting or disabling peripheral devices (particularly input devices) may be an easy fix. Many times people have Bluetooth devices paired with their systems that can sit many feet away and keep a system active.

  2. Reset the power manager
    Sleep routines on Mac systems are governed by the power manager, which hold variables that determine what sleep modes the system will go into. If the power manager is not working properly then the system may show in odd sleep and wake behaviors. Apple has some detailed instructions for resetting the SMC on various Mac systems. While technically you can try setting the system to perform only specific sleep behaviors, different Macs have different default sleep behaviors and changing these can result in the system not being able to sleep at all. As a result, my recommendation is to simply reset the SMC so the system's default sleep mode is established in the power manager, instead of specifying a particular sleep mode.

  3. Remove the sleep image file
    When a Mac goes into hibernation it writes the RAM contents to a file called "sleepimage," and if this file is corrupt then the system may have a hard time accessing it properly. An easy way to fix any problems arising from this is to remove the file by running the following command in the Terminal (supply your password when prompted after entering this command):

    sudo rm /private/var/vm/sleepimage

    Removing the sleep image is a safe procedure, since the system will just automatically re-create it when it next needs it.


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.

Tags:
Computers
About the author

    Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.

     

    Join the discussion

    Conversation powered by Livefyre

    Show Comments Hide Comments