I have an OSX machine I'm trying to automatically run applications on remotely via SSH. Everything works great, as long as the user is already logged into the computer. If I log out, or reboot the computer, my application fails until I log in again.
Is there any way to trigger a desktop login over SSH? I'm looking to avoid needing to manually intervene via Remote Desktop and the like. In case it matters, I'm running Mavericks presently, but will be upgrading to Yosemite soon.
I could, in theory, configure it to login automatically at boot, but I'd prefer a scripted solution I can run, assuming such a thing is possible.
I also found this article from 2005 suggesting this is possible with osascript
, but it fails on Mavericks:
$ osascript -e 'tell application "System Events" to keystroke "USERNAME"'
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
36:55: execution error: An error of type -10810 has occurred. (-10810)