1

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)
2
  • What applications - if GUI then you will need to be logged in as it is only after you login you can write to the screen - command lines can be run without this login
    – mmmmmm
    Commented Mar 26, 2015 at 1:31
  • @Mark yes, that is what I am asking. I need to be logged in in order to run my application, what's the best way to do that programmatically?
    – dimo414
    Commented Mar 26, 2015 at 1:46

1 Answer 1

1

For now, I'm going to just configure the computer to login automatically at boot. Instructions for Mountain Lion and Yosemite.

If anyone knows how to configure this via the Terminal, rather than System Preferences, I'd prefer that solution.

You must log in to answer this question.

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