I’ve been having a problem with my MacBook where it wakes up when the lid is closed, which leaves me hot and bothered when it’s in my bag.
Apparently it’s a know problem on early model MacBooks, caused by the magnet that determines whether the lid is open getting shifted when the lid gets bumped.
The easy fix is to run:
$ sudo pmset -a lidwake 0
which will disable waking the machine when the lid is opened. Mash the keyboard instead, and you’ll be right as rain.
Also, this commands prints a real time log of all power management activity detected by OS X:
$ pmset -g pslog