Clear all

Mail sleeping  



I'm running macOS High Sierra 10.13.4 on a 2009 iMac. I've got the screen set to go to sleep after 1 hour, and the computer to never sleep (it's running Indigo, jabberd, iTunes, and Server, so I don't want it to sleep, ever).

The computer never appears to sleep -- I can access my services regularly, even after not having touched the machine for days.

However, Mail does appear to sleep. I've got several rules set, and I can tell that Mail has snoozed off when I open Mail on my iPhone or iPad and see a ton of messages in my inbox that should've been filed elsewhere. 

I can SSH onto the system, and can do anything I like, but while the system is awake, the Mail app doesn't wake up. I go back to the iMac (even remotely through a shared desktop) or move the mouse or tap on the keyboard, and *poof*, the messages get filtered properly -- as observed on iOS, remotely. Mail has awoken.

I've tried setting the following:

defaults write NSAppSleepDisabled -bool YES

and while I first thought it might be working, was proven wrong today.

pmset -g assertions

shows that PreventUserIdleSystemSleep is set to 1 and NetworkClientActive is 1, too.

pmset -g

shows that the system is prevented from sleeping by a ton of serverd processes.

What am I missing? Is Mail really going to sleep? Does it have some other strange mode it can get into that will prevent it from running its rules? 



How Mail interacts with the hosting server is different depending on whether it is connecting via POP, IMAP, or Exchange. 

I have previously done troubleshooting of Mail & Outlook connection "inconsistencies" by using Netstat to confirm what connections are being held open. That might help you uncover more info? 

4 Answers

Try disabling App Nap altogether


How is Mail > Preferences > Settings > General > Check for new messages set? It's possible that "Automatically" includes some logic that results in "but not so obsessively unless we know the user is around" or some such. Perhaps setting it to a fixed interval would help?

Failing that, what about running `caffeinate` from the Terminal to ensure the system remains awake?


@DaveHamilton wins. Or actually, I win -- Dave just set me on the right path.

Setting the program to check for mail on a regular schedule keeps it from going to sleep. It's obvious why that works -- what's not obvious is why turning off App Nap doesn't work. le sigh...

Thanks! Problem resolved.

I’m back. It went to sleep again.



Don't want you to think I'm not responding -- I've tried @datafornothinandbitsforfree's suggestion to disable AppNap system-wide, and not had another recurrence since then. However, another variable has changed, in that I've wound up using the system multiple times a day since implementing that change. So, I've changed 2 variables, hence the test results are inconclusive.

I'll report back after this batch of tasks is done and the system usage has quiesced again. If this doesn't work, then I'll try Dave's suggestion (and yeah, it's currently set to Automatically.)


And it went to sleep again. So, I'm setting the mail update period to every ½ hour, and we'll see how that goes.


I've been waiting to post this just to make sure that the problem's truly gone. I've not had the system go back to sleep since I made the last change over a month ago. The problem was recurring at least weekly.

The change? Simple: I had originally set the iMac to wake up every day at 5AM. (Preferences > Energy Saver > Schedule... > Start up or wake = Every Day 05:00 AM.

I turned that off, and no more problems.

Bizarre, but true. That was the only setting change I made. I don't think I'm going to bother testing by turning it back on again, unless someone's really, really interested in the results...

Bizarre. So this was causing it to wake at random times, not just at 5am?

@DaveHamilton - I think the original problem was sort of the reverse, in that the Mail app seemed to be sleeping when the display was sleeping even though the OS was not sleeping.