Something keeps waking up my Mac, how do I find out what it is?

You can see a log of power events with pmset -g log or or syslog.

$ pmset -g log | grep ' Wake  ' | tail -n5
10/29/12 10:31:20 PM GMT Wake      Wake due to EHC2/HID Activity: Using BATT (Charge:99%)                       
10/30/12 12:51:56 AM GMT Wake      Wake due to EC.LidOpen/Lid Open: Using BATT (Charge:68%)                     
10/30/12 8:50:33 AM GMT+ Wake      Wake due to EC.LidOpen/Lid Open: Using AC (Charge:100%)
10/30/12 5:12:32 PM GMT+ Wake      Wake due to EC.LidOpen/Lid Open: Using AC (Charge:99%)                       
10/31/12 12:58:01 PM GMT Wake      DarkWake to FullWake due to HID Activity: Using AC (Charge:44%)              
$ syslog | grep 'Wake reason' | tail -n5
Oct 30 03:14:26 MacBook-Air kernel[0] <Debug>: Wake reason: EC.LidOpen (User)
Oct 30 17:12:05 MacBook-Air kernel[0] <Debug>: Wake reason: ?
Oct 30 17:12:31 MacBook-Air kernel[0] <Debug>: Wake reason: EC.LidOpen (User)
Oct 30 23:08:18 MacBook-Air kernel[0] <Debug>: Wake reason: EC.ACAttach EHC2 (Maintenance)
Oct 31 12:57:52 MacBook-Air kernel[0] <Debug>: Wake reason: ?

The post at OS X Daily has descriptions of the abbreviations.

  • OHC: stands for Open Host Controller, is usually USB or Firewire. If you see OHC1 or OHC2 it is almost certainly an external USB keyboard or mouse that has woken up the machine.
  • EHC: standing for Enhanced Host Controller, is another USB interface, but can also be wireless devices and bluetooth since they are also on the USB bus of a Mac.
  • USB: a USB device woke the machine up
  • LID0: this is literally the lid of your MacBook or MacBook Pro, when you open the lid the machine wakes up from sleep.
  • PWRB: PWRB stands for Power Button, which is the physical power button on your Mac
  • RTC: Real Time Clock Alarm, is generally from wake-on-demand services like when you schedule sleep and wake on a Mac via the Energy Saver control panel. It can also be from launchd setting, user applications, backups, and other scheduled events.

Go to System Preferences and click Energy Saver. Then, uncheck "Wake For Network Access." That is the most likely problem. Good luck!