Macos – preventing the MacBook from sleeping

macbookmacospower-managementsleep

I have a MacBook Air and I have noticed that even though I have configured it to put itself into sleep mode after being inactive for 5 minutes it sometimes stays awake.

I've usually got a bunch of programs open (Tweetie, iTunes, Safari, iChat etc) but it there some way I can find out which program/process that is preventing the MacBook from sleeping? (Yes, I know that I could probably reboot the MacBook and try one program at a time but that is pretty tedious)

Best Answer

Try this. It might work for you.

  1. Go to Utilities in the Applications folder and open the "Terminal" app.

  2. Type pmset -g and hit Enter

  3. If "sleep" has 0 next to it and the words "imposed by" or "prevented by ; The number next to the imposed by is the process ID causing the problem. Copy that number.

  4. Type ps -e | grep <process ID here> and hit Enter. This will list all running processes that have that ID (will also include the grep process)

In my case it was process id 19 which turned out in this instance to be a print server process. I went to "Print & Scan" in System Preferences and reset deleting all installed printers from there. . . Problem solved. I added the one printer that I needed and sleep still works. I don't yet understand quite how printing can get this way with the sleep mode.