Getting exception Command 'xcrun' is not found. Is it installed? while executing using eclipse
The problem
When I am trying to start the appium server programmatically and then instantiate the IOSDriver, I am getting the Exception Command 'xcrun' is not found. Is it installed?
Environment
- Appium version (or git revision) that exhibits the issue:1.13.0
- Desktop OS/version used to run Appium: macOS Mojave
- Node.js version (unless using Appium.app|exe):v12.6.0
- Npm or Yarn package manager: Npm
- Mobile platform/version under test: ios 12.4
- Real device or emulator/simulator: Simulator
Details
Please find the testng trace: java.lang.RuntimeException: Failed to initialize Test --- Failed to start Device --- Error in starting the DeviceFailed to getDriver --- An unknown server-side error occurred while processing the command. Original error: Command 'xcrun' not found. Is it installed? Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z' System info: host: 'HQSML-152086', ip: '2601:88:8201:5f80:b91e:11d:3bdd:5188', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '1.8.0_151' Driver info: driver.version: GetMobileDriver remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Command 'xcrun' not found. Is it installed? at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:826:9) at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:447:37) at com.comcast.utils.ComcastTestMain.startTestMain(ComcastTestMain.java:1138) at com.comcast.utils.ComcastTestMain.beforeTest_startTestMain(ComcastTestMain.java:955) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138) at org.testng.TestRunner.beforeRun(TestRunner.java:648) at org.testng.TestRunner.run(TestRunner.java:616) at org.testng.SuiteRunner.runTest(SuiteRunner.java:359) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312) at org.testng.SuiteRunner.run(SuiteRunner.java:261) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1191) at org.testng.TestNG.runSuitesLocally(TestNG.java:1116) at org.testng.TestNG.run(TestNG.java:1024) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
I am not getting this issue when I am starting the appium server manually and instantiating the IOSDriver
https://github.com/appium/appium/search?q=%22Command+%27xcrun%27+is+not+found%22&type=Issues
Closed as duplicate
I referred to these links but could not resolve my issue. Could you please help me in resolving this. Thanks
@mykola-mokhnach I referred to these links but could not resolve my issue. Could you please help me in resolving this. Thanks
Unfortunately we cannot help there. This is a problem with your operating system. xcrun is part of the standard Xcode installation. If it is not there it most likely means the deployment is broken due to an unknown reason
Are the command line tools for Xcode installed?
@mykola-mokhnach xcrun is working fine on terminal. I can see this issue only when I am running the script through eclipse. If i keep the appium server started, the test runs fine. When I am starting the appium server using AppiumServiceBuilder, only then I am running into this. If you cant help, could you please tell me who can help me here?
@imurchie yes command line tools are installed.
Then it's probably not in your PATH in Eclipse.
@imurchie How can i set it in my eclipse PATH? I just need to add it to my PATH environment variable in eclipse. correct?
I have added the path /Applications/Xcode.app in the PATH variable in the eclipse

@imurchie @mykola-mokhnach Can someone kindly help me on this... I am still not able to figure out the issue... It is somehow working fine with the intelliJ but giving the error with eclipse. If you can tell me what is the environment variable i need to update, that would be greta help. Thanks.
I don't use Eclipse so I cannot say how to do it, specifically. I can just point you to the java client's docs on environment variables. https://github.com/appium/java-client/blob/master/docs/environment.md
The developers on that repo might have more information on things.
@imurchie Thanks... Could you please move this ticket to appim-java-client repo and change the status to Open
@imurchie Thanks a lot
@SrinivasanTarget So no one can give me resolution on this forum? I am still getting this issue when using eclipse but it is working fine with IntelliJ
@Sourabh25 : Hi Sourabh , were you able to find solution to this issue?