1

I am running a /Library/LaunchDaemons service at boot time - nobody is logged in. I want the computer to not sleep. Here's my pmset -g on macOS Sierra 10.12.4:

System-wide power settings:
Currently in use:
 standbydelay         4200
 standby              0
 womp                 1
 halfdim              1
 hibernatefile        /var/vm/sleepimage
 powernap             0
 gpuswitch            2
 networkoversleep     0
 disksleep            10
 sleep                0
 autopoweroffdelay    28800
 hibernatemode        0
 autopoweroff         0
 ttyskeepawake        1
 displaysleep         10
 acwake               0
 lidwake              1

Whenever I log in through SSH, it takes a while, and whenever I try to connect to my running service via HTTPS there is a long delay (10 seconds or so). It seems like the system is going to sleep. I can't figure out how to disable this.

I have logged in as a user (only user on system), and set computer sleep and display sleep to never, unchecked put hard disks to sleep, left wake for network access on, and unchecked power nap. This is all for Power Adapter mode. Automatic Graphics Switching is still enabled.

This seems mostly related to not having a user logged in. When I'm logged in, it doesn't go to sleep.

4
  • Can you confirm that it is in fact going to sleep by checking it locally? Meaning, when you believe it's asleep go to the physical keyboard, and "wake it up." Is it immediate or does a it take a few seconds?
    – Allan
    Commented May 12, 2017 at 22:26
  • pmset -g log shows Maintenance Sleep. It looks like it might be due to the computer in clamshell mode (closed, no display connected).
    – nachum
    Commented May 13, 2017 at 0:45
  • Does InsomniaX work when no one has logged in? Looks like it's home page shows a "Start on Login" option, so I'm guessing not.
    – dwightk
    Commented May 13, 2017 at 13:43
  • My usecase has nobody logged in. Slightly different than the other question.
    – nachum
    Commented May 14, 2017 at 16:15

2 Answers 2

0

Go to System Preferences → Energy Saver and disable Put hard disks to sleep when possible.

2
  • I have already done this. Doesn't stop sleep in the case when nobody is logged in.
    – nachum
    Commented May 11, 2017 at 17:03
  • @nachum please be sure to add all relevant info to your question, including what you've already tried. This will prevent others from offering answers that you've already attempted. See How to Ask for tips on asking good questions.
    – fsb
    Commented May 11, 2017 at 19:12
0

Run a script based from a launchdaemon which checks for a user logged into console. who | grep console

Then disable sleep accordingly by using

caffeinate or pmset

Check their man pages for options. There are other ways of getting the logged in user as well.

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