Apple - iMac randomly wakes up from sleep

A good first step towards debugging power management-related issues on OS X is:

pmset -g assertions

It can take a little practice to read the output, but it can lead to finding processes that are erroneously making power management assertions against the kernel.

It can also be an iterative process — keep running it at appropriate times, ad see what crops up!

The pmset command can do a whole lot more to control OS X power management; see the pmset(1) man page.


Edit: I have since found a way to determine if there are any processes keeping a Mac awake using only GUI tools. (Tested only on OS X 10.11):

  • First, open Activity Monitor (in /Applications/Utilities).
  • On its menu, select View → Columns → Preventing Sleep in order to display this column (which is not displayed by default).
  • You can now click on the header of the Preventing Sleep column to re-order the list of processes so that those preventing sleep are at the top.

This works in any of Activity Monitor’s five tabs, but you have to enable the Preventing Sleep column individually for each tab.