I’ve recently had a problem with my MacBook Pro not going to sleep while it’s plugged in. A few customers have recently come to me with the same problem, as well. Sometimes, I would notice that the fan would run all night, but I would open my computer up and nothing would really be going on that should make it stay awake.
The first place that I would encourage anyone to look for this is in System Preferences > Energy Saver. Make sure “Wake for network access” is not checked.
The fix for me in this case was in the system preferences, under Print and Fax. I’d selected “share this printer over the network” a long time ago for one of my printers, but it was now keeping my Mac from sleeping.
If you’d like to dig deeper, you could run this terminal script to get an exact view of what your machine’s settings look like.
I tried typing the following query in the Terminal
$ pmset -g
It should give an output similar to what you see here (in the figure below), but if you’re experiencing the problem, you’ll see something like:
sleep 0 (imposed by 35)
The application in reference for me ended up being this Print and Fax preference, but we would expect that other applications could also keep your computer from sleeping, and running one of these checks could help you get closer to the answer!