Last active
August 24, 2023 13:18
-
-
Save risinek/fd250ff81ce22d2c7744b1567de53675 to your computer and use it in GitHub Desktop.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
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
thanks for this handy script, but any solution for mirror all system's env variables to launchd?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
npm install -g appium
/Library/LaunchAgents/
launchctl load com.company.appium.server.plist
Appium server should start everytime it crashed or system was rebooted.