ESC[35m[XCUITest]ESC[39m Could not determine iOS SDK version: Command 'xcrun' not found. Is it installed?

I am using Appium 1.21.0 installed on a Mac on command line and want to use Appium programmatically. Hence I used npm install -g appium to install appium.

Next I have used launchctl to start appium on reboot and keep it alive incase of a crash. When I run my robot tests for IOS, I get below error in appium logs

ESC[35m[XCUITest]ESC[39m Could not determine iOS SDK version: Command ‘xcrun’ not found. Is it installed?

I dont get this error when I manually start appium on terminal “appium --port 4730” and my tests run fine.

Q. Why cant appium get xcrun when its launched by launchctl at startup?

  1. did you install xCode?
  2. did you complete for real device -> http://appium.io/docs/en/drivers/ios-xcuitest-real-devices/

Yes I have XCode 12.4 installed. I am not using real device. Like I said when I start appium on terminal, my tests run fine.

well in mean that appium server started in ‘launchctl’ does not see environment. you need add env paths to it.

<key>EnvironmentVariables</key>
<dict>
  <key>PATH</key>
  <string><![CDATA[/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin]]></string>
</dict>

Obviously the above might not solve your problem, you’ll need to test it and possibly add $PATH entries as needed.

Added /usr/bin to $PATH variable in my plist file and now works like a charm!

1 Like