16

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)

0

3 Answers 3

17

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.

1
  • 1
    Copy that number -> it only shows the name, not number.
    – Niing
    Apr 1, 2020 at 6:52
2

"Inactive" is hard to determine from looking at your system. You should use a process monitor, like "top" or "Activity Monitor" and see what is going on. You can quit apps to isolate the problem.

For browsers, flash or other plugins are often the cause. Your average web page is much more CPU intensive than it was a couple years ago. Also, background downloads probably also keep it from sleeping.

2
  • can a CPU-hogging browser prevent the MacBook from sleeping?
    – jimr
    Dec 19, 2010 at 22:30
  • I have seen flash-ads on the current page of the current browser cause a system to refuse to sleep-and-stay-asleep.
    – benc
    Dec 22, 2010 at 5:52
2

Try to use the command:

pmset -g

It will sometimes display the processes preventing your mac from sleeping.

Source: http://www.macobserver.com/tmo/article/osx_lion_pmset_shows_app_imposed_sleep/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .