Wake a Mac display from sleep via SSH

Posted by MaxGabriel on Super User See other posts from Super User or by MaxGabriel
Published on 2013-06-25T04:47:18Z Indexed on 2013/06/26 10:23 UTC
Read the original article Hit count: 242

Filed under:
|
|
|

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 :)

© Super User or respective owner

Related posts about osx

Related posts about mac