X

Tutorial: Preventing Portable Mac sleep problems

Tutorial: Preventing Portable Mac sleep problems

CNET staff
7 min read

Sleep can be temperamental for portable Macs (iBooks, PowerBooks, MacBooks, MacBook Pros) with systems sometimes exhibiting one or more of these symptoms:

Does not properly go to sleep when the lid is closed, remaining on and often resulting in an extremely hot-to-the-touch state with excessive fan activity and eventual shutdown.

  • Wakes from sleep inexplicably while the lid is closed, resulting in similar problems as the aforementioned
  • Fails to properly wake from sleep, often with a completely black screen and no responsiveness
  • This problem affects both Intel-based and PowerPC-based Mac portables. In many cases, it can be caused by interaction from peripheral devices: USB, FireWire, Bluetooth, Displays, even power connection. In other cases, power management, NVRAM or software issues are at fault.

What follows is a listing of the most commonly successful workarounds for these issues, along with indications for which problems they are most likely to resolve:

Unplug/plug first [Useful for: does not properly go to sleep; wakes from sleep while lid is closed; fails to wake from sleep]

Perhaps the most common causes for all sleep problems are problematic external USB or FireWire devices. Simply disconnecting all such devices before putting a system to sleep can often prevent the problems from occurring. Try disconnecting the devices in batches to identify a culprit(s).

A few examples of external devices that have caused sleep issues in the past:

Also, avoid connecting or disconnecting devices, or connecting/disconnecting power after your portable Mac has gone to sleep. USB devices in particular can trigger a wake from sleep.

Turn off, toggle settings of Bluetooth devices [Useful for: does not properly go to sleep; wakes from sleep while lid is closed]

It may be beneficial to un-pair and power-off any Bluetooth devices associated with Mac portable before putting it to sleep. It appears that turning Bluetooth devices on or off while the system is going to sleep can trigger a disconnection error message, barring proper sleep.

Further, you may need to turn off the "Allow Bluetooth devices to wake this computer." option in both of its System Preferences locations. First, go to the Bluetooth pane of System Preferences and turn this option off. Next go to the Keyboard and Mouse pane of System Preferences and turn the option off again.

Check for errant internal devices (expansion cards, hard drives, RAM) [Useful for: does not properly go to sleep; wakes from sleep while lid is closed; fails to wake from sleep]

Some PCI cards, hard drives, or other internal devices can prevent proper sleep. Make sure that all internal peripherals are using the latest firmware available from the manufacturer, or remove the devices in a trial-and-error process to identify the culprit. FireWire 800 PCI cards have been notorious in this regard, often preventing deep sleep. PCI-based ATA cards, PCMCIA and CardBus cards have also been frequently implicated.

If you suspect a faulty hard drive, experiment with a separate startup disk. If the sleep issues do not occur with the new drive, consider replacing your current startup disk.

Faulty RAM may also be the culprit of your sleep issues, especially if other strange issues are occurring. You can sometimes determine if you have a "bad" RAM module by using the Apple Hardware Diagnostic CD, included with all currently shipping Macintosh models. To use the Apple Hardware Test CD, restart your computer while holding down the C key on PowerPC-based Macs, or D key on intel-based Macs until the "Loading..." icon appears.

You may also want to try removing each RAM module one-by-one and checking for persistence of the problem(s).

Turn off AirPort, disconnect from networks before sleep [Useful for: does not properly go to sleep]

Disabling Network activity before sleep [Useful for: does not properly go to sleep; wakes from sleep while lid is closed; fails to wake from sleep]

Related to the above workaround, germinating all network activity -- in some cases necessitating a power-down of the AirPort card or disconnection of an Ethernet cable -- is, in some cases, particularly effective at eliminating the "blank screen on wake-up" issue.

In particular, try turning off any built-in AirPort hardware (via the AirPort menu item or using Internet Connect, located in Applications/Utilities) before putting a portable Mac to sleep.

Manually putting the system to sleep [Useful for: does not properly go to sleep]

Putting the system to sleep via the Apple menu or by pressing the power button and selecting the sleep option (rather than closing a portable Mac's lid) can work to avoid some sleep issues. Make sure that the system has properly gone to sleep -- indicated by the gently pulsating status light -- before closing the lid.

Turn off all Wake/Other options in Energy Saver [Useful for: does not properly go to sleep; wakes from sleep while lid is closed; fails to wake from sleep]

Turning off all special automatic sleep options has resolved sleep problems for some users. This can be accomplished by entering the Energy Saver pane of System Preferences, clicking on the "Show Details" button, then the "Options" tab, then un-checking all options, including:

  • Wake when the modem detects a ring
  • Wake for Ethernet Network administrator access
  • Restart automatically after a power failure

In some cases you may need to also turn off the "Put the hard disk(s) to sleep when possible" option, which is located under the "Sleep" tab in the Energy Saver pane of System Preferences.

Quit specific applications [Useful for: does not properly go to sleep]

Some applications, when active at sleep time, can cause machines to either not fall asleep or wake up soon after going to sleep. Though it's inconvenient, try quitting all third-party (and potentially some Apple) applications before putting your portable Mac to sleep and check for persistence of the issue.

As noted in Apple Knowledge Base article #303698, self-refreshing Web pages in Safari, songs playing in iTunes, or a movie disc playing in DVD Player can all prevent sleep. "Applications can be designed to keep the system awake and prevent idle sleep indefinitely. In developer lingo, an application may explicitly prevent system sleep by calling IORegisterForSystemPower(), and calling IOCancelPowerChange() when it receives a power management kIOMessageCanSystemSleep notification."

Set lidwake variable to 0 [Useful for: does not properly go to sleep; wakes from sleep while lid is closed]

Setting thelidwake variable to 0 will cause the machine to resist waking from sleep when the lid is opened. Instead, you will need to press a button on the keyboard or perform another "system event" (such as connecting and activating a USB device) in order to wake the system.

This can prevent instances of the problem where the system erroneously thinks the lid has been opened when it is still closed.

This can be accomplished with the following Terminal command:

  • sudo pmset lidwake 0

Deleting power management-related .plist files [Useful for: does not properly go to sleep; wakes from sleep while lid is closed; fails to wake from sleep]

In some instances, various sleep issues can be resolved by deleting the following files:

  • /Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist
  • /Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist
  • ~/Library/Preferences/com.apple.systemuiserver.plist

then restarting.

(the tilde [~] indicates your home user directory, i.e. /Users/username)

Unfortunately, this fix might not stick, and may require repetition if the problem(s) recurs.

Gently close lid -- ensure sleep is taking place [Useful for: does not properly go to sleep]

In some cases, carefully closing the lid and ensuring the system has actually gone to sleep (indicated by a slowly pulsating light) can prevent this issue from occurring.

Turn off safe sleep [Useful for: does not properly go to sleep; fails to wake from sleep]

"Safe Sleep" is a function writes the contents of RAM to a hard disk buffer. The buffer is then accessed and restored to RAM, creating an effect similar to merely putting the system to sleep though it has actually been turned off (no power being used).

Mac OS X uses virtual memory data (RAM contents naturally stored on disk as part of the virtual memory scheme) to formulate the sleepimage file. When the system is put to sleep, Mac OS X culls from physical RAM whatever data it cannot replicate from virtual memory and adds it to the sleepimage file. As such, if the system is put to sleep abruptly or something goes wrong during the write process, sleep can fail to properly occur.

If you think safe sleep might be to blame for your regular sleep issues, you can disable it by opening the Terminal (located in Applications/Utilities) and entering the following command:

  • sudo pmset -a hibernatemode 0

then pressing return. 

You can then select "Go to Folder" under the "Go" menu in the Finder, and enter: /private/var/vm then press return, and drag the file sleepimage to the Trash.. 

In order to re-enable Safe Sleep, use the command:

  • sudo pmset -a hibernatemode 3

in the Terminal.

Reset NVRAM [Useful for: does not properly go to sleep; wakes from sleep while lid is closed; fails to wake from sleep]

A number of users report that resetting NVRAM resolves wake-from-sleep issues. In order to perform this process, shut down your Mac, then start it back up while immediately holding the following keys: Command, Option, P and R. Hold the keys down until the computer restarts and you hear the startup sound for the third time.

Clear caches [Useful for: does not properly go to sleep; wakes from sleep while lid is closed; fails to wake from sleep]

Though it's a cliché workaround, you may also want to doing a deep clean of system caches with a tool like Cocktail or Tiger Cache Cleaner.

The problems that can be caused by corrupt caches are almost innumerable, and sleep issues are no exception.

Re-install Mac OS X [Useful for: does not properly go to sleep; fails to wake from sleep]

As a last resort, try re-installing Mac OS X via an Archive and Install process, then updating to their previously installed Mac OS X incremental release (or the release before they started having wake-from-sleep problems) has resolved this issue.

Like what you've found in this tutorial? Get more troubleshooting guidance (updated daily) by subscribing to MacFixIt Pro.

Resources

  • DYMO label printers can pr...
  • Sleep failure linked to Wa...
  • Oxford 911 FireWire sleep ...
  • #303698
  • Cocktail
  • Tiger Cache Cleaner
  • re-installing Mac OS X
  • subscribing to MacFixIt Pr...
  • More from Tutorials