I'm trying to setup Appium server to stat automatically after system startup. Also I'd like it to restart after a crash. Appium was installed as a npm package and it launches and works fine when I type "appium" in terminal.
So, what I did is created file io.appium.server.plist in /Library/LaunchAgents/ with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>io.appium.server</string>
<key>OnDemand</key>
<false/>
<key>UserName</key>
<string><valid_user_name></string>
<key>GroupName</key>
<string>staff</string>
<key>ProgramArguments</key>
<array>
<string>appium</string>
<string>--session-override</string>
</array>
</dict>
</plist>
Then assigned proper owner (chown) and permissions (chmod) to this file and executed the command:
sudo launchctl load /Library/LaunchAgents/io.appium.server.plist
For some reason this did not start appium server, I cannot connect to it. The "launchctl list" command reported that my task exited with 78 status code, but in Appium's documentation I cannot find what's meant by this exit code.
$ launchctl list | grep appium
- 78 io.appium.server
What did I miss? Why appium launches fine when its started from command line, but does not start from launchd?
I tried moving plist file into user's directory: ~/Library/LaunchAgents/ , changing UserName, but neither helped. I debugged it by setting StandardOutPath and StandardErrorPath keys, what I found is that the output files were created but were empty.