KittenSleeping

Mac Won’t Sleep – Mac OS X Lion Seems Having Insomnia (Fixed)

Michael Allen iFix, Mac, Mac OS X, Mac OS X, OS X Lion, Tips & Tricks 50 Comments

Mac Won’t Sleep; Lion Has Insomnia?

Last night, before I went to sleep, I closed the lid of my MacBook pro (MBP). This morning when I got up, I noticed that it was still running. Lion didn’t sleep for a whole night at all. Closing the lid of MBP while the machine is running blocks the airflow and could cause the machine over heated. I tried to switch the external hard drive on and off, turn the internet sharing on and off as well. but none had sovled the problem. It seems Mac OS X Lion won’t sleep.
If I unplug the power cord and close the lid then Mac OS X Lion would go sleep in a few seconds without any problems.

Solutions to Lion’s Insomnia:

  • Temporary Solution:
    Unplug the power cord and then close the lid. Your Mac should be sleeping after a few seconds. Then connect the power cord back.
  • Long-Term Solution:
    1. Open Terminal Open Terminal on Mac
    2. type:
      pmset -g assertions

      Examine the the output, and find out what service is preventing the Mac from going sleep. Line “PreventUserIdleSystemSleep 1″ means something is currently preventing the system from sleeping.

      pmset -g assertions

    3. From there, you can “kill” that suspicious process (in my case, it would be
      kill -9 22083

      ) or remove the service that prevents Lion from sleeping. Usually this has things to do with Internet, printer sharing or the secondary external monitor your laptop connects to.

Image Credit: Ryan Tir

Michael AllenMac Won’t Sleep – Mac OS X Lion Seems Having Insomnia (Fixed)

Comments 50

  1. Pingback: Saving Wordle Word Clouds | Introduction to Digital Humanities

  2. Isoruku

    Many thanks! I followed your advice and the problem was “nodisplaysleepassertion” whatever that means. I killed it and my Macbook now can go to sleep. Unlike me.

  3. grähm

    OK so now I know that my Mountain Lion now also wont sleep due to “com.apple.InternetSharing” .. (thanks OP) however since I regularly share the internet (for Iphone/Pad) around the house, its fairly annoying to have to keep killing/turning it off when I want to sleep the mac. How can I restore the Lion behaviour : Sleeping also sleeps the shared internet, and starts it again on wake ? :-/

  4. AndreM

    Thanks for this tip. I also found internet sharing being a cause. It is actually in the text, in the system preferences, but like most people missed it. I imagine anything that prevents sleep should be indicated by an icon, such as a crossed out bulb.

    This is really a usability omission. If the system can’t sleep for any reason, then it should clearly be communicated to the user, so it can be resolved. Pretending to sleep and not really sleep just leads to the belief that the system has a sleep bug. I also believe that there should be an option to force sleep.

  5. Pinhead

    PowerBook 15″, OS 10.8.1 external monitor Apple 21″

    None of the above worked for me. Only unplugging the cord would do the job, but it’s annoying.

    Running Terminal:
    BackgroundTask 1

    Listed by owning process:
    pid 41(mds): [0x0000000c0000012c] 00:16:17 BackgroundTask named: “com.apple.metadata.mds”

    kill that one still no good. Any suggestion are welcome… thanks

  6. Alex

    I have tried all of this and my mac still won’t sleep. When I type in pmedit -g assertions it doesn’t list anything that is preventing the computer from sleeping. When I force it to sleep or when I close the lid (regardless of whether the power is connected) it will go to sleep for about a second or 2 and then the apple on the top will flash and it will come out of sleep.

    Any suggestions?

  7. Freesailer

    This trick helped me to find that internet sharing prevented my Mac Pro from sleeping. This allows now forced sleeping with the menu command. However, the Mac Pro still does not sleep by itself as set in the energy saver. Enable idle sleep and External media shows a 1.
    I use Apples Software Disk array and have the boot disk in one of the arrays, could that be the reason? I currently use the PleaseSleep freeware to force the mac to sleep but would prefer if the OS X could do the job without additional help. BTW, I unmounted all drives besides the boot drive but that did not change the status.

  8. James Davis

    Just a huge thank you to ALL of you above for the advice re check printer is not shared and that no print jobs are pending – I had both without knowing so took weeks of trying other things before this dawned on me that it was the reason my iMac would not sleep!! Cured instantly and I do not normally blog at all but had to say Thank you which I do again.

  9. Eashan

    Assertion status system-wide:
    ChargeInhibit 0
    PreventUserIdleDisplaySleep 0
    PreventUserIdleSystemSleep 0
    NoRealPowerSources_debug 0
    CPUBoundAssertion 0
    EnableIdleSleep 1
    PreventSystemSleep 0
    DisableInflow 0
    DisableLowPowerBatteryWarnings 0
    ExternalMedia 0
    I get this but don’t know what to do now!
    Tried turning off printer sharing etc nothing happens. What to do??

  10. Starwatcher22

    Disabling “printer sharing” in the sharing-settings does the trick – my MacPro Lion sleeps fine now

    Thanks for providing all tips an tricks around this topic

  11. Gautam

    Thanks so much – who would have guessed that a random printer that I connected to at a friend’s house was preventing my mac from going to sleep!

  12. Andrius

    after running pmset -g assertions I’ve got

    PreventSystemSleep 1
    pid 51: [0x0000012c00000033] PreventSystemSleep named: “org.cups.cupsd”

    Opening printer print queue at ssytem preferences and deleting all jobs for printing fixed the sleeping issue. Hope this would help.

  13. Zachary

    Oh. my. goodness.

    After reading dozens of pages of support forums, this was the fix for me.

    Actually, I found out the problem is 1 of 3 things:
    1. one of your printers has something in the print queue — delete any active items trying to print.
    2. print sharing is on — so turn it off
    3. delete any old printers you’re no longer using.

    For me, I had an old printer with something still in the queue. Crazy that would cause this problem. Thanks for the help.

  14. Andy

    Thanks!! This was most helpful! org.cups.cupsd was keeping my system from sleeping. Found out the airport express into which it was plugged had been knocked from the wall, the printer was turned off and another user on this MacBook had some outstanding print jobs to the printer. In short, it was “In Use”. I got the printer going once more and killed the print jobs and then after a while it went to “Idle”. Now when I check pmset I find there are 0 PreventSystemSleep processes. Most helpful indeed!!

  15. Taylor

    I tried this, and whenever my computer is plugged in, it is showing a “1” value for “PreventSystemSleep”, but when I unplug it, that value changes to 0. I tried to kill the program stopping the computer from going to sleep (9884, org.cups.cupsd), and terminal is saying “-bash: kill: (9884) – Operation not permitted.” Any help?

    1. John Godley

      Hey Taylor, it looks like the printer is causing your the problem. Try to disable it the printer sharing and delete the driver if necessary and see whether it’s fixed.

  16. Adam

    Thanks for this, I had the same problem with an unused printer. The terminal showed that the org.cups.cupsd process was stopping the sleep mode, so I deleted the printer.

  17. JP

    Thank, thank you! My issue had to do with a CUPS process: I’d kill the process, it’d come back, I realized that recently I purchased a new Brother printer. Removed the two instances from the list of printers on my System Prefs, the process finally was killed. Computer goes to Sleep. Yes!!!
    It was driving me crazy! Can’t thank you enough…

  18. Mackfreak

    Hello all,
    Sorry for my English, i’m from The Netherlands.
    I’m having problems to get my Macbook (2.2 GHZ intel core duo 10.6.8) pro to sleep too, due to an external projector.

    I use this Mac as a media player. Therefor this projector is always connected (via a HDMI/DVI adapter), and now and then used. If i want to play a movie i just turn my projector on.
    Most of the times i use the Macbook as a music player, en then i don’t need a monitor. I use my Iphone for navigation. So, i hardly ever need the Macbook monitor.
    I’d like too keep the Macbook on and ready for use, but automatically in sleep mode when not used for a while.
    The problem is that the energy settings (system preferences)) don’t work when the hdmi/dvi is plugged in.

    If i type pmset -g assertions in Terminal, i get this result:

    Assertion status system-wide:
    ChargeInhibit 0
    NoDisplaySleepAssertion 1
    CPUBoundAssertion 0
    EnableIdleSleep 1
    NoIdleSleepAssertion 0
    DisableInflow 0
    DisableLowPowerBatteryWarnings 0
    ExternalMedia 1

    Listed by owning process:
    15: ExternalMedia value=255 named: “com.apple.powermanagement.externalmediamounted”
    205: NoDisplaySleepAssertion value=255 named: “wake machine”
    205: NoDisplaySleepAssertion value=255 named: “Nameless (via IOPMAssertionCreate)”

    At that moment i also used screen sharing (this Macbook screen on another Mac).

    Is there a way to have the Macbook connected to the Projector and occasionally use screen sharing on another Mac or Iphone but still go to sleep when not used (and of course not go to sleep when playing a movie or music)?
    It seems so basic to me.

    I don’t know how to work with Terminal, unless i know the codes to use.
    Thanks..

  19. wealthychef

    Pretty cool. I will keep this, but I found it the hard way, by trial and error: I had Remote Management turned on, which disables sleep apparently.

  20. Aaron McGraw

    Thanks so much. I thought my mac had been kidnapped by some corrupt spyware or something else very Microsoft and horrible… but no – after running the pmset -g assertions command I discover that, yep, I have an old printer which is ‘in use’… PreventSystemSleep named: “org.cups.cupsd”
    Sheesh!! Deleted printer. Problem solved!

  21. Giulio

    brilliant, the pmset -g assertions allowed me to find out that it was cupsd blocking the sleep, and some of the users comments made me check the printers, there was one marked as “in use” even though I unplugged it weeks ago, (when the insomnia problem started) :)

    thanks all

  22. Homer31

    You might try the “Please Sleep” app. It is a “free” shareware app. Make sure you get the updated Lion version. It works. Not sure why Apple doesn’t make this more user friendly & robust. I had this problem during Snow Leopard also. I paid the Please Sleep guy for it. But that is optional.

  23. Dave Smith

    I ran the “pmset -g assertions” command and discovered my Wi-Fi sharing was on. My system is working properly after turning the Internet sharing off. Thanks.

  24. Alex

    Thanks so much! My problem was com.apple. Internet sharing!!! So I just turned it off! It is now sleeping like a baby and now so will I! Thanks again! Would just like to add that when I sent my laptop(under warranty) off to fix this problem they said it was the logic board and replaced it! How dumb! Thanks again!

  25. Marie Alhomme

    Thanks a bunch, the whole “pmset -g assertions” command line just saved me!
    I discovered an old wifi printer hadn’t been uninstalled and since it was since gone it kept trying to connect to it, thus preventing sleep…
    Darn you, cups! :)
    I almost tore all my hair out the last 10 days…

  26. Michael

    My iMac with update to Lion did not want to go to sleep too. “pmset -g assertions” helped to identify that Internet Sharing was on. I turned it off and Mac went to sleep just fine.

  27. Mike Manzano

    To find out why your system won’t sleep, type:

    pmset -g assertions

    In my case, I saw:

    Listed by owning process:
    pid 63: [0x0000012c0000003f] PreventSystemSleep named: “org.cups.cupsd”

    cups is the printing system, so I went into the system prefs and deleted my printer drivers. The system then slept.

  28. Jesus

    I just bought the macbook pro 13 inch (thunderbolt) and came with Snow Leopard but Apple gave me a Free Lion Upgrade. I have noticed that when I close the lid on the power chord it obviously stays awake like everyone here, but when I open the lid the airport its reconnecting to the network, in other words it disconnects from the internet when the lid its closed although its not sleeping… this is annoying cuz if I’m downloading an update i can’t close the lid. If i close the lid on battery power the it does goes to sleep. They should make an update with a fix to configure this ASAP! this topic its from July and its September already!

  29. apartment19

    My MacBook Pro sleeping problem has been fixed. I don’t know exactly how it was fixed. I just remember I did two things: (1) I updated to the latest version of iTune, (2) I plug the external monitor back
    I assumption is that it has something to do with the external monitor not being found since I have been travelling when I stalled the lion. I am very happen now that I can just simply close the lid of my MacBook just like b4.

  30. Hoong Ern Ng

    Have you tried running “pmset -g assertions” from the terminal when it won’t sleep? This may give you an idea on what is causing your mac to be sleepless. I had the same headache with my iMac.

    The command lets you know any conditions which may be preventing the mac from sleeping, and it seems that the conditions vary depending on whether the mac is plugged in or running on battery, which may be why you can sleep it when it’s not plugged in.

    1. kevin

      in terminal, type >pmset -g assertions
      This lists if a PreventSleepCondition exists, and lists the culprits.

      My result:
      pid 17: [0x0000012c00000011] PreventSystemSleep named: “org.cups.cupsd”
      pid 278: [0x0000012c00000116] PreventUserIdleSystemSleep named: “com.apple.audio.’AppleHDAEngineOutput:8,0,1,2:0′.noidlesleep”
      typing:
      sudo kill 17 (password required)
      and
      sudo kill 278
      got my macbook pro to sleep with power connected. On reboot these might reload, however I now know the culprits.

      1. Alex

        This done it for me. After I sudo kill the “org.cups.cupsd”. I tried reboot my computer and It still work. Finally my Macbook can have peaceful sleep. Thanks!

  31. Gustav

    Closing the lid of a MacBook (regular or Pro model) does not block the airflow and cause it to overheat. Running a closed MacBook with an external display is a configuration supported by Apple.

    1. Rich

      I think they should at least warn you when your computer is not going to sleep and have an option to override anything that is preventing sleep (at your own risk of course). But flexibility is not Apple’s forte. They don’t spend a lot of time improving existing features.

Leave a Reply

Your email address will not be published. Required fields are marked *