Running .app bundled application in non GUI environment causing app to fail at runtime

I am having a bundled application(.app file) and I am wanting to run this application via ssh session which does not have GUI access. Launching this application in a desktop GUI session, runs the application perfectly. However, on running it on the same machine via ssh session produces an error.

Note: My application does not bring up any GUI window(it' just produces some logs on the terminal), so running it in a non-GUI environment should have worked.

I get the below error when trying to launch the unix exe in the .app bundle( ./Myapp.app/Contents/MacOS/Myapp ) on the terminal. I have observed that applicationDidFinishLaunching(_:) gets called and then the below error occurs.

+[NSXPCSharedListener endpointForReply:withListenerName:replyErrorCode:]: an error occurred while attempting to obtain endpoint for listener 'ClientCallsAuxiliary': Connection interrupted

I tried running other bundled applications via ssh, but all seems to produce the same error. Can someone confirm Is running bundled application in a non GUI session not allowed by Apple. If its allowed, how can I solve this?

Even running the .app file using the open command fails to launch the application, although it produces a different error which is consistent across different applications.

I am having a bundled application(.app file) and I am wanting to run this application via ssh session which does not have GUI access.

That’s unlikely to end well )-: For background on this, read the Execution Contexts section of Technote 2083 Daemons and Agents. While that technote is super old, the core concepts it describes are still largely accurate.

My application does not bring up any GUI window …

That’s not the gating factor. When running outside of a GUI login context, it’s best to stick with daemon-safe frameworks. If you link to a GUI framework, like AppKit or SwiftUI, chances are you’ll run into problems.

My general advice is that you split your code into two executables: one that presents the GUI and one that’s appropriate to run in a non-GUI context. If you want to share code between the code, put that code in a framework and link both executables to that.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Running .app bundled application in non GUI environment causing app to fail at runtime
 
 
Q