I frequently run simulations from Terminal that take many hours, often overnight.

Normally I use the Caffeine menu-bar app to prevent sleeping during these runs. If I forget to do that, the job continues to run during sleep, but at about 50% of normal speed.

Does anyone know why that happens? My first guess was a power-saving strategy, but my laptop power adaptor is always plugged in.

This is not a critical problem for me, I'm just curious. Normally I disable sleeping, and if I forget, at worst I get about half as much work done overnight than I expect.

1 Answer 1


The definition of system sleep requires the CPU to either quiesce or power off its cores. This means that no code is running during the time that the system is actually sleeping. If you are seeing progress on your computation, it means that the system is awake during that time. On Macs, there is a concept known as a dark wake, which is when everything is running except for the display and speakers, and system fans are best-effort disabled, so from an observer's perspective the system still looks like it's sleeping even though it's actually fully on. Certain high-performance subsystems will be throttled back during this time for energy and thermal reasons, so some of the tasks running during a dark wake will be slower.

Dark wakes happen for a number of reasons. You can see a record of system sleep and wake events using the pmset command:

pmset -g log

If you run this and look for the timestamps corresponding to when your system was supposed to be asleep, you are going to find a surprisingly high number of Sleep -> DarkWake -> Sleep sequences during that period. This is when your simulation makes progress.

All of this is expected behavior. To avoid interrupting your simulation with a bunch of sleep-wake-sleep sequences, you need to remember to use Caffeine or the caffeinate command. The latter, btw, allows you to chain your CLI invocation so that you're less likely to forget:

caffeinate /path/to/your/simulation/command

See caffeinate(8) for more details.

  • Wow, thank you very much! I consider myself a pretty knowledgable Mac user, and nearly every point you made was News To Me. Very helpful! Dec 11, 2022 at 23:00

You must log in to answer this question.

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