Why Your Mac Won’t Sleep


Your Mac won’t sleep? Learn how to diagnose why your Mac computer won’t go to sleep when you want it to.

Let's Begin:

It can be rather frustrating when you tell your Mac to go to sleep but it refuses to do so. The good news is that it’s fairly easy to diagnose the cause. All it takes is a quick trip to the Terminal app, but before we get to that, let’s cover one of the most frequent causes of Mac insomnia seen in Lion.

Internet Sharing Keeps Your Mac from Sleeping

If you have Internet Sharing turned on in the System Preferences then your Mac won’t go to sleep. This is true even if there are no active Internet connections being shared. Apple’s logic here is that your machine needs to be kept awake so that it can continue to share its Internet connection no matter what. If you don’t want this behavior, your only choice at present is to turn Internet Sharing off in the System Preferences. To check this, open the System Preferences and go to the Sharing section and you’ll see something like this:

Mac OS X System Preferences Sharing Pane showing Internet Sharing option

If you see Internet Sharing checked as it’s shown here, then that’s why your computer won’t sleep. If you don’t have Internet Sharing turned on, then continue reading to see how to diagnose the problem further.

Check the Power Management Settings

The next step is to look at the power management settings that Mac OS is using. There is no fancy GUI for this, so a trip to the Terminal is needed. (See Using the Terminal Application is you’re new to this.) Once you have the Terminal running, type this command:

pmset -g assertions | grep SystemSleep

It will respond with output that looks something like this:

PreventUserIdleSystemSleep              1
PreventSystemSleep                      1
pid 3280: [0x0000012c00000cd0] PreventSystemSleep named: “com.apple.InternetSharing”
pid 292: [0x0000012c00000124] PreventUserIdleSystemSleep named: “com.apple.audio.’AppleHDAEngineOutput:1B,0,1,3:1′.noidlesleep”

Like a lot UNIX commands, this output looks rather cryptic at first but it’s really pretty easy to interpret. The first two lines displayed here tell us that the two different flavors of system sleep prevention are enabled (i.e., set to 1). You may or may not see both of these set on your system since it depends on what’s running. The first one, PreventUserIdleSystemSleep, is set when an application is running that doesn’t want the system to sleep when the computer is otherwise idle. Normally, the computer will automatically sleep if you have the Energy Saver preferences enabled to put the system to sleep when idle. The PreventUserIdleSystemSleep setting overrides this. To see what part of Mac OS is doing the override, look for the line beginning with “pid” (which stands for process ID) and contains PreventUserIdleSystemSleep. In the above example output, we see it was set by com.apple.audio which is the Apple audio output module. In my particular case, I have Pandora playing and as long as it’s playing it will prevent the system sleeping when it is otherwise idle. The reason it overrides the idle sleep energy saver is so you can continue listening to music without having to touch the keyboard to keep it going. If you’re playing music with iTunes, the same thing will happen, namely it will prevent the system from sleeping as long as the music (or a movie) is playing.

The second line on the output above shows us that PreventSystemSleep is also enabled. This one stops your Mac from sleeping when you explicitly select Sleep from the Apple menu. To see who set this override we again look for a line beginning with pid that contains PreventSystemSleep. In above example, we see it was com.apple.InternetSharing which is Apple’s module that implements the Internet Sharing that we talked about above.

If you see a name listed other than com.apple.InternetSharing or com.apple.audio and are not sure what it is, just do a google search on the name and you should quickly arrive at a description of what the module does which should be enough to tip you off as to why it’s prevent your computer from sleeping. With this information, you should be able to help your Mac overcome its insomnia.

Category: Apple Mac OS X