New user in need of guidance: "xcodebuild failed with code 65"


#1

This is my first time trying to use Appium on Mac to automate iOS so forgive me if I missed something obvious. I am trying to automate Safari on a real iPad Pro with iOS 11.2.2 using Xcode 9.2 and Appium Desktop version 1.7.2. When I try to execute my “Hello World” JUnit test from Eclipse, I am seeing the following error in the Appium logs: “xcodebuild failed with code 65”.

I followed the guide and added my xcodeOrgId and xcodeSigningId to the capabilities, but still no luck. So far I have reinstalled Appium and Xcode and tried editing the WebDriverAgent.xcodeproj.

I’m too new to be able to tell if this is a bug or user error. Any help is much appreciated.

Here are the logs:

[info] [Appium] Welcome to Appium v1.7.2
[info] [Appium] Appium REST http interface listener started on 0.0.0.0:4723[info] [HTTP] --> POST /wd/hub/session {“desiredCapabilities”:{“automationName”:“XCUITest”,“browserName”:“Safari”,“deviceName”:“Charles’s iPad”,“platformName”:“iOS”,“platformVersion”:“11.2.2”,“udid”:“10575698fe14700b58b1c006a9eb99ebc40e60a1”,“xcodeOrgId”:“V2MR2VGH3V”,“xcodeSigningId”:“iPhone Developer”},“capabilities”:{“desiredCapabilities”:{“automationName”:“XCUITest”,“browserName”:“Safari”,“deviceName”:“Charles’s iPad”,“platformName”:“iOS”,“platformVersion”:“11.2.2”,“udid”:“10575698fe14700b58b1c006a9eb99ebc40e60a1”,“xcodeOrgId”:“V2MR2VGH3V”,“xcodeSigningId”:“iPhone Developer”},“firstMatch”:[{“browserName”:“Safari”,“platformName”:“ios”}]}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{“automationName”:“XCUITest”,“browserName”:“Safari”,“deviceName”:“Charles’s iPad”,“platformName”:“iOS”,“platformVersion”:“11.2.2”,“udid”:“10575698fe14700b58b1c006a9eb99ebc40e60a1”,“xcodeOrgId”:“V2MR2VGH3V”,“xcodeSigningId”:“iPhone Developer”},null,{“desiredCapabilities”:{“automationName”:“XCUITest”,“browserName”:“Safari”,“deviceName”:“Charles’s iPad”,“platformName”:“iOS”,“platformVersion”:“11.2.2”,“udid”:“10575698fe14700b58b1c006a9eb99ebc40e60a1”,“xcodeOrgId”:“V2MR2VGH3V”,“xcodeSigningId”:“iPhone Developer”},“firstMatch”:[{“browserName”:“Safari”,“platformName”:“ios”}]}]
[debug] [BaseDriver] Event ‘newSessionRequested’ logged at 1516403055142 (17:04:15 GMT-0600 (CST))
[info] [Appium] Merged W3C capabilities {“desiredCapabilities”:{“automationName”:"XCUIT… into desiredCapabilities object {“automationName”:“XCUITest”,“browserName”:"Saf…
[info] [Appium] Creating new XCUITestDriver (v2.64.0) session
[info] [Appium] Capabilities:
[info] [Appium] automationName: XCUITest
[info] [Appium] browserName: Safari
[info] [Appium] deviceName: Charles’s iPad
[info] [Appium] platformName: ios
[info] [Appium] platformVersion: 11.2.2
[info] [Appium] udid: 10575698fe14700b58b1c006a9eb99ebc40e60a1
[info] [Appium] xcodeOrgId: V2MR2VGH3V
[info] [Appium] xcodeSigningId: iPhone Developer
[info] [BaseDriver] Session created with session id: cc13e1e3-d4e0-4f38-ba8a-2c9b7ec99edc
[debug] [XCUITest] Current user: ‘solidworks’[debug] [XCUITest] Current version of libimobiledevice: stable 1.2.0 (bottled), HEAD
[debug] [XCUITest] Xcode version set to ‘9.2’ (tools v9.2.0.0.1.1510905681)
[debug] [XCUITest] iOS SDK Version set to ‘11.2’
[debug] [BaseDriver] Event ‘xcodeDetailsRetrieved’ logged at 1516403056162 (17:04:16 GMT-0600 (CST))[debug] [XCUITest] Available devices: 10575698fe14700b58b1c006a9eb99ebc40e60a1
[debug] [XCUITest] Creating iDevice object with udid ‘10575698fe14700b58b1c006a9eb99ebc40e60a1’
[info] [XCUITest] Determining device to run tests on: udid: ‘10575698fe14700b58b1c006a9eb99ebc40e60a1’, real device: true
[info] [XCUITest] Safari test requested
[debug] [BaseDriver] Event ‘appConfigured’ logged at 1516403056338 (17:04:16 GMT-0600 (CST))
[debug] [BaseDriver] Event ‘resetStarted’ logged at 1516403056338 (17:04:16 GMT-0600 (CST))
[debug] [XCUITest] Reset: running ios real device reset flow
[debug] [BaseDriver] Event ‘resetComplete’ logged at 1516403056339 (17:04:16 GMT-0600 (CST))
[debug] [iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog
[debug] [iOSLog] Starting iOS device log capture with: ‘idevicesyslog’[debug] [BaseDriver] Event ‘logCaptureStarted’ logged at 1516403056640 (17:04:16 GMT-0600 (CST))
[info] [XCUITest] Setting up real device
[info] [XCUITest] Using WDA path: ‘/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent’
[info] [XCUITest] Using WDA agent: ‘/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj’
[debug] [XCUITest] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [XCUITest] WDA is not listening at ‘http://localhost:8100/
[debug] [BaseDriver] Event ‘wdaStartAttempted’ logged at 1516403056731 (17:04:16 GMT-0600 (CST))
[info] [XCUITest] Launching WebDriverAgent on the device
[debug] [XCUITest] Carthage found: ‘/usr/local/bin/carthage’
[debug] [XCUITest] Killing running processes ‘xcodebuild.*10575698fe14700b58b1c006a9eb99ebc40e60a1, iproxy 8100’ for the device 10575698fe14700b58b1c006a9eb99ebc40e60a1…[debug] [XCUITest] ‘pgrep -nif iproxy 8100’ didn’t detect any matching processes. Return code: 1
[debug] [XCUITest] Starting iproxy to forward traffic from local port 8100 to device port 8100 over USB[debug] [XCUITest] Using Xcode 9.2, so fixing WDA codebase
[debug] [XCUITest] Generating xcode config file for orgId ‘V2MR2VGH3V’ and signingId ‘iPhone Developer’
[debug] [XCUITest] Writing xcode config file to /var/folders/yp/vnl7010n1kg2zvj4xt7d6h5m0000gp/T/2018019-34394-6kcthh.6efmg/appium-temp.xcconfig
[debug] [XCUITest] Using Xcode configuration file: ‘/var/folders/yp/vnl7010n1kg2zvj4xt7d6h5m0000gp/T/2018019-34394-6kcthh.6efmg/appium-temp.xcconfig’
[debug] [XCUITest] Beginning test with command ‘xcodebuild build-for-testing test-without-building -project /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=10575698fe14700b58b1c006a9eb99ebc40e60a1 IPHONEOS_DEPLOYMENT_TARGET=11.2 -xcconfig /var/folders/yp/vnl7010n1kg2zvj4xt7d6h5m0000gp/T/2018019-34394-6kcthh.6efmg/appium-temp.xcconfig’ in directory ‘/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent’
[debug] [XCUITest] Output from xcodebuild will not be logged. To see xcode logging, use ‘showXcodeLog’ desired capability[debug] [XCUITest] Waiting up to 60000ms for WebDriverAgent to start
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body[debug] [XCUITest] Log file for xcodebuild test: /var/folders/yp/vnl7010n1kg2zvj4xt7d6h5m0000gp/T/com.apple.dt.XCTest/IDETestRunSession-9D8920C2-32E0-41FE-9F76-B8E071558EDA/WebDriverAgentRunner-6ADADB1F-B62F-4800-8553-92F97F475AE4/Session-WebDriverAgentRunner-2018-01-19_170423-1xWZfU.log
[info] [Xcode] 2018-01-19 17:04:23.892 xcodebuild[34964:3448661] Error Domain=NSCocoaErrorDomain Code=260 “The file “WebDriverAgentRunner-Runner.app” couldn’t be opened because there is no such file.” UserInfo={NSFilePath=/Users/solidworks/Library/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app, NSUnderlyingError=0x7f8837466d00 {Error Domain=NSPOSIXErrorDomain Code=2 “No such file or directory”}}
[info] [Xcode] 2018-01-19 17:04:23.892 xcodebuild[34964:3448661] Error Domain=IDETestOperationsObserverErrorDomain Code=6 “Early unexpected exit, operation never finished bootstrapping - no restart will be attempted” UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted}
[info] [Xcode]
[info] [Xcode] ** TEST EXECUTE FAILED **
[info] [Xcode]
[info] [Xcode]
[info] [XCUITest] xcodebuild exited with code ‘65’ and signal ‘null’
[debug] [BaseDriver] Event ‘wdaStartFailed’ logged at 1516403063910 (17:04:23 GMT-0600 (CST))
[debug] [XCUITest] Unable to launch WebDriverAgent because of xcodebuild failure: “xcodebuild failed with code 65”. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
[debug] [XCUITest] Quitting and uninstalling WebDriverAgent, then retrying
[info] [XCUITest] Shutting down sub-processes
[info] [XCUITest] Shutting down iproxy process (pid 34963)
[debug] [XCUITest] iproxy exited with code ‘null’
[debug] [XCUITest] Removing WDA application from device[error] [XCUITest] Error: Unable to launch WebDriverAgent because of xcodebuild failure: “xcodebuild failed with code 65”. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
at XCUITestDriver.quitAndUninstall$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:375:13)
at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at
Error: Unable to launch WebDriverAgent because of xcodebuild failure: “xcodebuild failed with code 65”. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
at XCUITestDriver.quitAndUninstall$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:375:13)
at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at
[debug] [XCUITest] Not clearing log files. Use clearSystemFiles capability to turn on.
[debug] [iOSLog] Stopping iOS log capture
[error] [MJSONWP] Encountered internal error running command: Error: Unable to launch WebDriverAgent because of xcodebuild failure: “xcodebuild failed with code 65”. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
at XCUITestDriver.quitAndUninstall$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:375:13)
at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at
[info] [HTTP] <-- POST /wd/hub/session 500 9109 ms - 470 [info] [HTTP] --> GET /wd/hub/sessions {}
[debug] [MJSONWP] Calling AppiumDriver.getSessions() with args: []
[debug] [MJSONWP] Responding to client with driver.getSessions() result: []
[info] [HTTP] <-- GET /wd/hub/sessions 200 3 ms - 40


#2

I am also getting the same error. Does anyone knows the solution for it?
Using iphone 5s, version “10.2” ,appium desktop version 1.10


#3

It’s webdriver agent application signing issue.Try signing and installing the WebdriverAgentRunner manually on device by opening the project in Xcode.


#4

This is a webDriver Agent issue not the Appium.
follow this

Solution is there in the article.
In the Xcode , do this in build targets:
WebdriverLibAgent–> General tab.
change --> bundle identifier to com.facebook.companyname.appiumm
In Build Settings tab ,
change -->Product Bundle identifier to com.facebook.companyname.appiumm

WebdriverAgentRunner–> Build Settings tab

change —> Product Bundle identifier to com.facebook.companyname.appiumm

Once this is done, build the Xcode, should succeed.


#5

I wrote a detailed guide on how to get set up with iOS real devices. Has a bit more information than the docs linked above.