Wake a Mac display from sleep via SSH

6,747

The Screen Saver is a standalone program which is started and stopped by the system according to the set triggers, such as time, or a hot corner, and appears in the process status list, but only if it's running.

I was able to stop the screensaver by:

killall -1 ScreenSaverEngine

It starts again when I trigger it with a hot corner, and by the normal timer, I just checked.

Share:
6,747

Related videos on Youtube

MaxGabriel
Author by

MaxGabriel

Updated on September 18, 2022

Comments

  • MaxGabriel
    MaxGabriel over 1 year

    I'm using Jenkins as a CI server, where I'm SSHing into an iMac running OS X Mountain Lion (10.8.4) to run some UIAutomation integrations tests on an iOS app. The iMac actually sits 10 ft from me (but across a table) so I'm able to see the screen. However, the tests don't wake up the display, so I often can't see them.

    Is there a way to wake up the display from the terminal once Jenkins has SSHed in?

    So far I have tried using Applescript to press an arrow key, and using the Wake Assist application. I also tried setting the wake schedule to be the current date. Finally, I tried using the caffeinate command: caffeinate -t 300 &. The computer's "Wake for Wi-Fi access" checkbox is enabled.

    So far my best workaround is to just set the iMac to stay awake for atleast 3 hours. However, it'd be nice to keep normal sleep behavior, as I hypothesize that the screen waking from sleep would alert me visually that the integration tests are running. It's also significantly cooler :)

  • MaxGabriel
    MaxGabriel almost 11 years
    Hm.. I get No matching processes belonging to you were found (or a similar message when run with sudo), both on my machine and the iMac.
  • MaxGabriel
    MaxGabriel almost 11 years
    I'll try listing all processes to see if it's there.
  • Hansika Weerasena
    Hansika Weerasena almost 11 years
    Note that it'll only be there if the screensaver is running.
  • Hansika Weerasena
    Hansika Weerasena almost 11 years
    Thanks for asking about this, I love the idea of waking up the screen to remind me to have a look at it.
  • Fred Yankowski
    Fred Yankowski over 4 years
    This was helpful when my Mac Pro got stuck in the screensaver and the shift-ctrl-eject key combo was not available because I was temporarily using a PC keyboard with no Eject key (shift-ctrl-F12 did not work).