Sleep modes on Mac systems are convenient for saving power while preserving your workflow, and can be set up in the Energy Saver system preferences for various power schemes (batteries, power adapters, and UPS units).
The system should stay in sleep unless specifically commanded to wake; however, there are times when the system may randomly wake from sleep. This can be irritating because it wastes power, especially for laptop batteries; however, it can also be concerning for those who might wonder if their systems are being accessed.
Though systems generally wake up because of user input (clicking a mouse or typing on the keyboard), there are a number of other ways that a system can be inadvertently awoken.
- Peripheral devices
USB activity is a sure way to wake a sleeping Mac, and is the reason why typing on wired keyboards does this. Likewise, any peripheral device you have connected may also wake the system. Merely plugging in a device will do this, so if you have one connected and it turns on, that will also wake the Mac. Additionally, faults in the devices such as a broken key on a keyboard that is constantly sending information to the computer will prevent it from going to sleep for very long.
To troubleshoot these devices, try setting your system to sleep after a short period of inactivity (1 minute is the minimum) in the Energy Saver system preferences, and then unplug all of them from your system (including the keyboard and mouse). After doing this, wait for the system to sleep and see if it wakes up on its own. If not, then try plugging the peripherals back in one at a time (starting with the keyboard and mouse), and see if the same behavior occurs.
If you are able to pinpoint a specific device, then you can further investigate its settings or options that could be causing the problem.
- IR services
Modern Mac systems do not include an infra-red sensor, but for a while Apple included these for controlling Front Row and other applications using the included remote control. If the system senses infra-red activity, it may wake from sleep, so if you do not use the remote control, you might benefit from disabling the infrared sensor in the Security system preferences. If you do use the remote, then it may be helpful to ensure that it is paired with the system. By default your Mac will not be paired with a specific remote, which allows it to be controlled by any remote device. If you pair it with your remote, then it will only respond to your specified remote and ignore other infrared activity.
To pair the remote, in the Security & Privacy system preferences, click the Pair button and follow the onscreen instructions.
- Disable wake on network access
Apple has made extensive use of the common Wake on LAN (WOL) feature in network interfaces that can start up a system remotely using a special network packet called a "magic packet." This packet uses the system's MAC address (a unique code that all network interfaces have) to identify it and issue a command to wake up. This feature is used by Apple for a number of its sharing services, including Bonjour-enabled service like iTunes sharing, Printer and File sharing, and even for Internet-based access such as Back to My Mac.
Apple uses the service with its Airport Base Station or Time Capsule devices, which act as a "Bonjour Sleep Proxy" that registers the device and allows it to be accessed when it is asleep. When you try networking with the device when it is sleeping, the proxy will issue the magic packet to wake it up and allow you to access it.
Even if you do not have a sleep proxy on your network, the Mac may still be woken if a magic packet is sent to it, and it will also periodically wake briefly in an attempt to register with a sleep proxy. This behavior is historically enabled on Ethernet devices, but on newer Macs you can use the Airport connection for this option as well. To prevent this behavior, you can disable the WOL feature by unchecking "Wake for network access" the Energy Saver system preferences. If your system supports WOL over Wi-Fi only, then you will see this called "Wake on Airport network access," and if it supports WOL on Ethernet only, then you will see "Wake on Ethernet network access."
Do keep in mind that with this feature disabled, you will need to manually wake your system to access file-sharing services and other network-based services that should wake the system up.
- Check input devices
When troubleshooting peripherals to clear this problem, you can check any USB keyboards and mice you have attached to the system, but in addition you can check all input device options for your system. These can include mice, trackpads, and keyboards that may use their own Wi-Fi technology (such as those little USB Wi-Fi adapters), but also may be Bluetooth-enabled options.
Most Mac systems shipped since around 2006 contain a Bluetooth radio that can be used to communicate not only with mice and keyboards, but also with cell phones and audio devices like headphones and microphones. Activity from any of these devices can wake a Mac system up; this can happen if the device is within 20 to 30 feet of the Mac, even if it is in another room.
To troubleshoot Bluetooth activity, disable the radio in the Bluetooth system preferences (be sure you have a USB mouse and keyboard available before you do this) and see if the system can stay in sleep mode. If so, then try troubleshooting individual Bluetooth devices by enabling the radio and then checking to see which ones are paired with the Mac in the Bluetooth menu or system preferences. Then locate each device and turn it off completely and optionally unpair it from the system (delete it from the Bluetooth devices list) to see if that helps.
Do the same actions for all other input devices (Wi-Fi or otherwise), but be sure to check if the system can maintain sleep after you make each change.
- Check Energy Saver scheduling
While not a random behavior, if you have system startup or wake scheduled in the Energy Saver system preferences, then the system will wake up at the specified times. To see if your system is scheduled to sleep or wake up, go to the Energy Saver system preferences and click the "Schedule..." button. Then ensure that the check boxes for this option are unchecked so no scheduled power options are enabled.
- Reset the SMC
Sleep behaviors are governed by the system's power manager (called the System Management Controller or SMC). This is a hardware component that contains options for when the system sleeps and how it goes to sleep, among other features for governing system lights and fan controls. Corruption in any of these settings could cause the system to wake up from sleep without being directly instructed to do so. Therefore, the easiest way to clear the problem is to reset the SMC to its default settings.
The instructions for doing this are specific to different Mac systems and can be found in Apple's knowledge-base article on resetting the SMC on Intel-based Macs. The power manager for PowerPC-based Macs is called the Power Management Unit (or PMU) and usually requires pressing a button on the motherboard to reset, of which Apple provides instructions for PowerBook and iBooks, iMacs, and PowerMac systems.
While these troubleshooting steps are presented in a fairly straightforward manner, sometimes they may need to be repeated several times with various combinations of settings enabled and disabled before you see a pattern of one setting combination resulting in the unwanted behavior.