I'm working on automating the installation of a macOS application using Ansible. I am installing the application by copying its .app folder from a .dmg image to the /Applications/ directory.
After doing this, I attempt to launch the application via SSH with:
sudo -u buildworker open -a /Applications/Name.app
However, I receive the following error message:
The application /Applications/Name.app cannot be opened for an unexpected reason, error=Error Domain=RBSRequestErrorDomain Code=5 "Launch failed."
Strangely, if I log into the machine's GUI and manually start the application once, subsequent attempts to launch it via SSH work perfectly.
Has anyone encountered a similar issue before? Is there any way to "pre-initialize" the application so that it can be launched via SSH without a manual first-time GUI launch?
OS: macOS Monterey (12.6.7)
- The app is not in com.apple.quarantine
- I disabled gatekeeper The app
- The app is completly signed for macOS