Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

For me, Mountain Lion always seems to sleep whenever there is no user action, even when the computer is still doing something. In my case it always sleeps in the middle of running a batch operation in Lightroom 4.1, and it has slept while Time Machine is still cleaning up.

According to Siracusa's ML review, apps need to be written to make "power assertions" if they want to stop the computer from sleeping. Otherwise, sleep it will. This seems like a way too aggressive strategy, especially to implement by default in a new OS? There must be many, many apps that have not been written to make these power assertions (including it seems parts of Apple's own Time Machine backup process).

Is there a hidden preference somewhere to revert to the old method of sleep at least until we get better app support for this? I'm not looking for a solution to supress sleep entirely (I know I can just tell the computer to never sleep), but rather to stop sleeping while it's still doing something.

Additional info:

  1. My Mac does not support Power Nap (mid 2009 13" MBP)
  2. My power settings in system preferences are set to the default, as follows:

pmset -g:

Active Profiles:
Battery Power       -1*
AC Power        -1
Currently in use:
 hibernatemode        0
 acwake               0
 lidwake              1
 halfdim              1
 sleep                10
 ttyskeepawake        1
 sms                  1
 hibernatefile        /var/vm/sleepimage
 disksleep            10
 displaysleep         2

pmset -g cap:

Capabilities for Battery Power:
 displaysleep
 disksleep
 sleep
 acwake
 lidwake
 lessbright
 halfdim
 sms
 ttyskeepawake
 hibernatemode
 hibernatefile

System log before and after a particular problematic sleep state (subsequent wake was not due to user input but rather a "DarkWake"):

    2012-07-27 00:32:07.343 com.apple.launchd[1]: (com.apple.iCloudHelper[3859]) Exited: Killed: 9
    2012-07-27 00:32:07.000 kernel[0]: memorystatus_thread: idle exiting pid 3859 [com.apple.iCloud]
    2012-07-27 00:32:12.416 com.apple.time[13]: Next maintenance wake [Backup Interval]: <date: 0x7fea7b6235f0> Fri Jul 27 00:45:48 2012 CEST (approx)
    2012-07-27 00:32:12.416 com.apple.time[13]: Requesting maintenance wake [Backup Interval]: <date: 0x7fea7b6235f0> Fri Jul 27 00:45:48 2012 CEST (approx)
    2012-07-27 00:32:13.000 kernel[0]: AirPort_Brcm43xx::powerChange: System Sleep 
    2012-07-27 00:32:14.000 kernel[0]: 00000000  00000020  NVEthernet::setLinkStatus - not Active
    2012-07-27 02:20:14.000 kernel[0]: Wake reason: RTC (Alarm)
    2012-07-27 02:20:14.000 kernel[0]: RTC: Maintenance 2012/7/27 00:20:13, sleep 2012/7/26 22:32:15
    2012-07-27 02:20:14.000 kernel[0]: AirPort_Brcm43xx::powerChange: System Wake - Full Wake/ Dark Wake / Maintenance wake
share|improve this question
    
Since there are so many options to power management, have you isolated this to either on battery or on power (or both) and also consider listing the results of pmset -g and pmset -g cap in case your settings are not standard. The various log options of pmset may also be invaluable to see what is happening (or has happened) if the system.log isn't detailed enough for your needs. –  bmike Jul 27 '12 at 17:38
    
Same here. Updated to ML few days ago. I was watching a movie with my wife served from her iMac (as we always do) and the iMac slept at the defined time even though it was streaming the file!! Very annoying. It used to be perfect pre-ML where the sleep was prevented when there was activity. support.apple.com/kb/HT1776?viewlocale=en_US&locale=en_US –  gamov Aug 14 '12 at 3:10
    
Yeah many people had problems with their Mac not sleeping, myself included. Now it seems the problem lies the other way round :) –  kLy Aug 15 '12 at 7:17

2 Answers 2

up vote 11 down vote accepted
caffeinate -i open -W -a Lightroom.app

should keep the system awake as long as Lightroom is running and not idle. To prevent any sleep at all, use -s instead of -i.

share|improve this answer
    
This is awesome and upvoted :) Definitely useful in a tight spot. However not really an adequate solution globally since I would manually need to run this on every process that's doing something. –  kLy Aug 7 '12 at 11:36

As a fellow media-server-from-an-iMac guy (I also use Subsonic to stream my iTunes library over the air to my phone) I feel your pain.

** Oops, just saw the other answer - my 2nd option will still work though ** Try going to a terminal prompt and typing "man caffeinate" - I believe you can use that to script the power management assertion.

Or easier, download a free mini app for your taskbar called Caffeine, which toggles a no-sleep mode, which can even be set to persist for a period of time. Works for me. :-) HTH

share|improve this answer
1  
Yeah thanks :) I am aware of these solutions, however they are both manual. I am rather looking for a way for ML to automatically not sleep should there be I/O or CPU activity the way that previous versions of OS X has done. –  kLy Aug 22 '12 at 8:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.