Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This is the example of working plist to run Appium server using launchctl on Mac. See comments for more info and steps how to use this.
<?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>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>Label</key>
<string>com.company.appium.server</string>
<key>RunAtLoad</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/node</string>
<string>/usr/local/lib/node_modules/appium/build/lib/main.js</string>
</array>
<key>StandardOutPath</key>
<string>/Users/path/to/logs/stdout.log</string>
<key>StandardErrorPath</key>
<string>/Users/path/to/logs/stderr.log</string>
<key>EnvironmentVariables</key>
<dict>
<key>ANDROID_HOME</key>
<string>/path/to/android-sdk</string>
<key>JAVA_HOME</key>
<string>/path/to/java-home</string>
<key>PATH</key>
<string>/content/of/path/env/var</string>
</dict>
</dict>
</plist>
@risinek

This comment has been minimized.

Copy link
Owner Author

commented Mar 12, 2018

  1. You need to have appium installed using npm install -g appium
  2. Copy this file to /Library/LaunchAgents/
  3. Run launchctl load com.company.appium.server.plist
    Appium server should start everytime it crashed or system was rebooted.
@balazs630

This comment has been minimized.

Copy link

commented Sep 18, 2019

Thanks for posting this, it worked for me! 👍
Removed the StandardOutPath, StandardErrorPath parts and the EnvironmentVariables part because we use it for iOS only. And simply set:

<key>KeepAlive</key>
<true/>

NOTE: I copied the plist file to the user specific LaunchAgent folder:

~/Library/LaunchAgents

(not to the system folder)
When the plist was placed in /Library/LaunchAgents/ I got errors that the binary for Carthage is not found, missing from the PATH.

After a reboot, you can verify in Terminal if Appium Server is running:
lsof -n -i:4723 | grep LISTEN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.