# Unable to launch WebDriverAgent because of xcodebuild failure: "xcodebuild failed with code 65"

**URL:** <https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332>\
**Category:** Support\
**Created:** [October 25, 2017, 12:20pm UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332 "2017-10-25T12:20:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![KARUNAKAR](https://discuss.appium.io/user_avatar/discuss.appium.io/karunakar/32/7992_2.png) [@KARUNAKAR](https://discuss.appium.io/u/KARUNAKAR)\
**Post date:** [October 25, 2017, 12:20pm UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/1 "2017-10-25T12:20:53Z")

</div>

An unknown server-side error occurred while processing the command. Original 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](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. (WARNING: The server did not provide any stacktrace information)  
Command duration or timeout: 42.41 seconds

---

<div class="post-metadata">

**Author:** ![KARUNAKAR](https://discuss.appium.io/user_avatar/discuss.appium.io/karunakar/32/7992_2.png) [@KARUNAKAR](https://discuss.appium.io/u/KARUNAKAR)\
**Post date:** [October 25, 2017, 12:25pm UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/2 "2017-10-25T12:25:10Z")

</div>

This is my code:

package IOSRealDevice;  
import java.net.MalformedURLException;  
import java.net.URL;  
import java.util.concurrent.TimeUnit;  
import io.appium.java\_client.ios.IOSDriver;  
import io.appium.java\_client.remote.MobileCapabilityType;  
import org.openqa.selenium.remote.DesiredCapabilities;

public class TestReal{

```
public static void main(String[] args) throws MalformedURLException, InterruptedException {
	
	DesiredCapabilities cap = new DesiredCapabilities();
	cap.setCapability("xcodeConfigfile", "Users/karna/Desktop/Config.xcconfig");
            cap.setCapability(MobileCapabilityType.PLATFORM_NAME,"iOS");
	cap.setCapability(MobileCapabilityType.PLATFORM_VERSION,"10.13");
	cap.setCapability(MobileCapabilityType.DEVICE_NAME,"karnaiMac's iPhone");
	cap.setCapability("xcodeOrgId", "added name XXXXX");
	cap.setCapability("xcodeSigningId", "iPhone Developer");

	cap.setCapability("agentPath", "/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj");
	cap.setCapability("bootstrapPath", "/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent");

	cap.setCapability("udid", "iphone udid xxxxxx");
	cap.setCapability("keychainPath", "/Users/karna/Library/Keychains/login.keychain-db");
	cap.setCapability("keychainPassword", "xxxxxx");
	cap.setCapability("automationName", "XCUITest");

    //xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=iphone udid' WebDriverAgent

	cap.setCapability(MobileCapabilityType.APP,"/Users/karna/Library/Developer/Xcode/DerivedData/Appname-csixnohoxphlboetngjflnzcatmi/Build/Products/Debug-iphoneos/Appname.app");
	IOSDriver driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"),cap);
	driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

```

}

}

---

<div class="post-metadata">

**Author:** ![Venkatesh\_Akula](https://discuss.appium.io/user_avatar/discuss.appium.io/venkatesh_akula/32/7260_2.png) [@Venkatesh\_Akula](https://discuss.appium.io/u/Venkatesh_Akula)\
**Post date:** [October 25, 2017, 4:19pm UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/3 "2017-10-25T16:19:54Z")

</div>

Follow the steps in this video and check if it helps

[https://youtube.com/watch?v=TprXEKBnfmA](https://youtube.com/watch?v=TprXEKBnfmA)

---

<div class="post-metadata">

**Author:** ![KARUNAKAR](https://discuss.appium.io/user_avatar/discuss.appium.io/karunakar/32/7992_2.png) [@KARUNAKAR](https://discuss.appium.io/u/KARUNAKAR)\
**Post date:** [October 26, 2017, 2:13pm UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/4 "2017-10-26T14:13:47Z")

</div>

Thanks for the response… @Venkatesh_Akula.  
I follow the each and every step but still its displaying same error. I need to resolve this error as soon as possible , Please guide me any once.

---

<div class="post-metadata">

**Author:** ![Venkatesh\_Akula](https://discuss.appium.io/user_avatar/discuss.appium.io/venkatesh_akula/32/7260_2.png) [@Venkatesh\_Akula](https://discuss.appium.io/u/Venkatesh_Akula)\
**Post date:** [October 26, 2017, 4:42pm UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/5 "2017-10-26T16:42:57Z")

</div>

Did WebDriverAgent showed you ‘Build Succeeded’ in Xcode?

---

<div class="post-metadata">

**Author:** ![freddy](https://discuss.appium.io/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@freddy](https://discuss.appium.io/u/freddy)\
**Post date:** [October 27, 2017, 12:08am UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/6 "2017-10-27T00:08:06Z")

</div>

This seem recent problem for me. Last week my dev environment was working just fine. Appium 1.7.1 both UI version and console version were working. I also have iOS11 on my real device iPhone. I have followed these steps many times before and it worked. Yes it compiles in xCode too.

Then today I launch Appium UI and I see an update message. Let it download and restart. Now when I launch a session it either does not work or it takes a crazy long time. Like I gave up waiting, and went to do something else. Then later I see it actually worked. Just too forever.

---

<div class="post-metadata">

**Author:** ![freddy](https://discuss.appium.io/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@freddy](https://discuss.appium.io/u/freddy)\
**Post date:** [October 27, 2017, 12:17am UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/7 "2017-10-27T00:17:20Z")

</div>

Finding same thing launching the inspector tool from Appium UI.

Start Server v1.7.1  
Click on UI inspector tool icon  
See dialog pop up  
Select from my pre-saved settings that I have been using for a while now  
Start Session

See cute little spinny thing rotating around. Session actually starts on phone. Back on the Mac cute spinny thing still going and going.

---

<div class="post-metadata">

**Author:** ![KARUNAKAR](https://discuss.appium.io/user_avatar/discuss.appium.io/karunakar/32/7992_2.png) [@KARUNAKAR](https://discuss.appium.io/u/KARUNAKAR)\
**Post date:** [October 27, 2017, 6:41am UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/8 "2017-10-27T06:41:17Z")

</div>

Yes @Venkatesh_Akula. Its displaying Build Succeeded. But the WebDriverAgent app is not displaying in mobile.

---

<div class="post-metadata">

**Author:** ![Venkatesh\_Akula](https://discuss.appium.io/user_avatar/discuss.appium.io/venkatesh_akula/32/7260_2.png) [@Venkatesh\_Akula](https://discuss.appium.io/u/Venkatesh_Akula)\
**Post date:** [October 27, 2017, 6:47am UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/9 "2017-10-27T06:47:48Z")

</div>

When you run the test case keep an eye on your Mobile screen, the webdriver agent app will be installed and uninstall immediately. I don’t know the reason for this, but what you should do here is as soon as you see the webdriver agent app installed disconnect the cable from mac

Then in iPhone \> Settings \> General \> Profiles & Device Management

webdriver agent will be listed here \> tap on it and click ‘Trust’ option. Come to home screen & click on webdriver agent app once, you should see the app opens & a black screen is displayed.

Reconnect the device and rerun your test cases., it should work.

---

<div class="post-metadata">

**Author:** ![venkat4](https://discuss.appium.io/letter_avatar_proxy/v4/letter/v/e9c0ed/32.png) [@venkat4](https://discuss.appium.io/u/venkat4)\
**Post date:** [November 11, 2017, 1:08am UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/10 "2017-11-11T01:08:15Z")

</div>

Hello @Venkatesh_Akula @KARUNAKAR Are you able to resolve this issue

I am also getting same problem and could not able to find the root cause, i think i had code sign everything properly but getting the same error

“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](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.

---

<div class="post-metadata">

**Author:** ![Venkatesh\_Akula](https://discuss.appium.io/user_avatar/discuss.appium.io/venkatesh_akula/32/7260_2.png) [@Venkatesh\_Akula](https://discuss.appium.io/u/Venkatesh_Akula)\
**Post date:** [November 11, 2017, 1:43am UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/11 "2017-11-11T01:43:48Z")

</div>

@venkat4 my issue is resolved, check if this video helps.

[https://youtube.com/watch?v=TprXEKBnfmA](https://youtube.com/watch?v=TprXEKBnfmA)

---

<div class="post-metadata">

**Author:** ![KARUNAKAR](https://discuss.appium.io/user_avatar/discuss.appium.io/karunakar/32/7992_2.png) [@KARUNAKAR](https://discuss.appium.io/u/KARUNAKAR)\
**Post date:** [November 13, 2017, 6:38am UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/12 "2017-11-13T06:38:24Z")

</div>

Thanks to all… My issue also resolved.

---

<div class="post-metadata">

**Author:** ![venkat4](https://discuss.appium.io/letter_avatar_proxy/v4/letter/v/e9c0ed/32.png) [@venkat4](https://discuss.appium.io/u/venkat4)\
**Post date:** [November 13, 2017, 5:44pm UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/13 "2017-11-13T17:44:20Z")

</div>

@Venkatesh_Akula i tried everything whatever is explained in the video except this (Settings =\> General =\> Device Management on the device to trust the developer and allow the WebDriverAgentRunner)

I could not find WebDriverAgent in device management settings to trust it. is there anything else i need to do?  
and by the way is it simulator or real device in the video?

---

<div class="post-metadata">

**Author:** ![Venkatesh\_Akula](https://discuss.appium.io/user_avatar/discuss.appium.io/venkatesh_akula/32/7260_2.png) [@Venkatesh\_Akula](https://discuss.appium.io/u/Venkatesh_Akula)\
**Post date:** [November 14, 2017, 6:43am UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/14 "2017-11-14T06:43:54Z")

</div>

\*\* Ensure you trust the developer in your real iPhone else, the app will get deleted as soon as its installed.

When you run the test case keep an eye on your Mobile screen, the webdriver agent app will be installed and uninstall immediately. I don’t know the reason for this, but what you should do here is as soon as you see the webdriver agent app installed disconnect the cable from mac

Then in iPhone - Settings - General - Profiles & Device Management

webdriver agent will be listed here - tap on it and click ‘Trust’ option. Come to home screen & click on webdriver agent app once, you should see the app opens & a black screen is displayed.

Reconnect the device and rerun your test cases., it should work. Try this multiple times until you get it right.

---

<div class="post-metadata">

**Author:** ![venkat4](https://discuss.appium.io/letter_avatar_proxy/v4/letter/v/e9c0ed/32.png) [@venkat4](https://discuss.appium.io/u/venkat4)\
**Post date:** [November 16, 2017, 5:32am UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/15 "2017-11-16T05:32:01Z")

</div>

@Venkatesh_Akula When webdriver agent app is installed and then when i removed the cable, i could not find in iPhone - Settings - General - Profiles & Device Management. Tried several times but no luck. is there any other work around

---

<div class="post-metadata">

**Author:** ![Venkatesh\_Akula](https://discuss.appium.io/user_avatar/discuss.appium.io/venkatesh_akula/32/7260_2.png) [@Venkatesh\_Akula](https://discuss.appium.io/u/Venkatesh_Akula)\
**Post date:** [November 16, 2017, 5:39am UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/16 "2017-11-16T05:39:28Z")

</div>

Oh, you have to unplug the cable immediately. You can follow the steps in this link for other ways to make this work.

[https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md](https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md)

---

<div class="post-metadata">

**Author:** ![venkat4](https://discuss.appium.io/letter_avatar_proxy/v4/letter/v/e9c0ed/32.png) [@venkat4](https://discuss.appium.io/u/venkat4)\
**Post date:** [November 16, 2017, 5:53am UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/17 "2017-11-16T05:53:22Z")

</div>

Yes followed all the steps but no luck, i am not understanding which configuration or permissions got messed up. I had open ticket, please check for detail info

> <https://github.com/facebook/WebDriverAgent/issues/792>

---

<div class="post-metadata">

**Author:** ![Mobile\_Automation](https://discuss.appium.io/user_avatar/discuss.appium.io/mobile_automation/32/12392_2.png) [@Mobile\_Automation](https://discuss.appium.io/u/Mobile_Automation)\
**Post date:** [March 25, 2018, 6:20am UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/18 "2018-03-25T06:20:44Z")

</div>

@venkat4 Guys, it happens when setup for appium have some problem in configuring webdriver-agent in appium library, you can even configure webdriver-agent with free apple developer account as well, follow these steps in video: [https://www.youtube.com/watch?v=dyijACVRQOc](https://www.youtube.com/watch?v=dyijACVRQOc)  
It worked for me, hope it will help everybody here!  
Still you find any problem, comment on that video, they will follow 🙂 Happy testing:)

---

<div class="post-metadata">

**Author:** ![villaoj](https://discuss.appium.io/letter_avatar_proxy/v4/letter/v/9d8465/32.png) [@villaoj](https://discuss.appium.io/u/villaoj)\
**Post date:** [March 26, 2018, 4:48am UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/19 "2018-03-26T04:48:39Z")

</div>

I am able to launch WebDriverAgentRunner but it just opens and closes with appium logs as below:

* * *

[Xcode] 2018-03-26 15:44:15.722 xcodebuild[60272:1079899] 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}  
[Xcode]  
[Xcode] \*\* TEST EXECUTE FAILED \*\*  
[Xcode]  
[Xcode]  
[Xcode] 2018-03-26 15:44:15.558835+1100 WebDriverAgentRunner-Runner[340:134041] +[CATransaction synchronize] called within transaction  
[Xcode] 2018-03-26 15:44:15.620290+1100 WebDriverAgentRunner-Runner[340:134041] Running tests…  
[Xcode] 2018-03-26 15:44:15.665479+1100 WebDriverAgentRunner-Runner[340:134041] The bundle “WebDriverAgentRunner” couldn’t be loaded because its executable couldn’t be located. Try reinstalling the bundle.  
[Xcode]  
[XCUITest] xcodebuild exited with code ‘65’ and signal ‘null’  
[BaseDriver] Event ‘wdaStartFailed’ logged at 1522039455748 (15:44:15 GMT+1100 (AEDT))  
[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](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.  
[XCUITest] Quitting and uninstalling WebDriverAgent, then retrying  
[XCUITest] Shutting down sub-processes  
[XCUITest] Shutting down iproxy process (pid 60271)  
[XCUITest] iproxy exited with code ‘null’  
[XCUITest] Removing WDA application from device  
[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](https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md).

* * *

But when executing using a simulator, the test executes successfully.

---

<div class="post-metadata">

**Author:** ![Bittu\_Kumar](https://discuss.appium.io/letter_avatar_proxy/v4/letter/b/51bf81/32.png) [@Bittu\_Kumar](https://discuss.appium.io/u/Bittu_Kumar)\
**Post date:** [September 9, 2020, 6:02am UTC](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332/20 "2020-09-09T06:02:10Z")

</div>

@villaoj Experiencing the same issue. Did you get any solution for the same?  
Appium Desktop: 1.15.1  
iPhone XR: 13.5(real device)  
Xcode: 11.7

I have already tried below mentioned steps but issue didn’t resolve:

1. Getting ‘Build Succeeded’ for WebDriverAgent in Xcode
2. Changed the Dev id in Xcode
3. Updated Product bundle identifier in build setting of WebDriverAgent Runner in Xcode
4. Trusted the certificate under Setting-\>General-\>Device & Management but it’s disappearing after uninstalling the WDA(automatically).

[Next page](https://discuss.appium.io/t/unable-to-launch-webdriveragent-because-of-xcodebuild-failure-xcodebuild-failed-with-code-65/19332.md?page=2)
