Unable to launch WebDriverAgent because of xcodebuild failure: Command 'Scripts/bootstrap.sh -d' exited with code 1

Hello, I am attempting to use Appium with a real iOS device, below are my desired capabilities;

{
"platformName": "iOS",
"automationName": "XCUITest",
"deviceName": "iPhone",
"udid": "f1bbe834a1fc129e93a1fe5d91e75b16143dfafd",
"platformVersion": "12.4",
"bundleId": "com.foo.bar",
"xcodeSigningId": "iPhone Developer",
"xcodeOrgId": "XXXXXXXXXX"
}

And below is the output:

[Appium] Welcome to Appium v1.13.0
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> GET /wd/hub/sessions
[HTTP] {}
[GENERIC] Calling AppiumDriver.getSessions() with args: []
[GENERIC] Responding to client with driver.getSessions() result: []
[HTTP] <-- GET /wd/hub/sessions 200 5 ms - 40
[HTTP] 
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"automationName":"XCUITest","bundleId":"com.foo.bar","deviceName":"iPhone","platformName":"iOS","platformVersion":"12.4","udid":"f1bbe847a1fc129e93a1fe5d91d94a16134dfadf","xcodeOrgId":"XXXXXXXXXX","xcodeSigningId":"iPhone Developer","newCommandTimeout":0,"connectHardwareKeyboard":true}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"automationName":"XCUITest","bundleId":"com.foo.bar","deviceName":"iPhone","platformName":"iOS","platformVersion":"12.4","udid":"f1bbe847a1fc129e93a1fe5d91d94a16134dfadf","xcodeOrgId":"XXXXXXXXXX","xcodeSigningId":"iPhone Developer","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1565707405044 (10:43:25 GMT-0400 (EDT))
[Appium] Appium v1.13.0 creating new XCUITestDriver (v2.113.2) session
[Appium] Capabilities:
[Appium]   automationName: XCUITest
[Appium]   bundleId: com.foo.bar
[Appium]   deviceName: iPhone
[Appium]   platformName: iOS
[Appium]   platformVersion: 12.4
[Appium]   udid: f1bbe847a1fc129e93a1fe5d91d94a16134dfadf
[Appium]   xcodeOrgId: XXXXXXXXXX
[Appium]   xcodeSigningId: iPhone Developer
[Appium]   newCommandTimeout: 0
[Appium]   connectHardwareKeyboard: true
[BaseDriver] Creating session with MJSONWP desired capabilities: {"automationName":"XCUITest...
[BaseDriver] Session created with session id: ab2bc0ef-7bc3-4235-bd01-3062d097bfe3
[XCUITest] Current user: 'johndoe'
[XCUITest] Available devices: f1bbe847a1fc129e93a1fe5d91d94a16134dfadf
[XCUITest] Creating iDevice object with udid 'f1bbe847a1fc129e93a1fe5d91d94a16134dfadf'
[XCUITest] Determining device to run tests on: udid: 'f1bbe847a1fc129e93a1fe5d91d94a16134dfadf', real device: true
[XCUITest] iOS SDK Version set to '12.2'
[BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1565707405467 (10:43:25 GMT-0400 (EDT))
[BaseDriver] Event 'appConfigured' logged at 1565707405468 (10:43:25 GMT-0400 (EDT))
[BaseDriver] Event 'resetStarted' logged at 1565707405468 (10:43:25 GMT-0400 (EDT))
[XCUITest] Reset: running ios real device reset flow
[BaseDriver] Event 'resetComplete' logged at 1565707405469 (10:43:25 GMT-0400 (EDT))
[iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog
[iOSLog] Starting iOS device log capture with: 'idevicesyslog'
[XCUITest] Crash reports root '/Users/johndoe/Library/Logs/CrashReporter/MobileDevice/iPhone' does not exist. Got nothing to gather.
[BaseDriver] Event 'logCaptureStarted' logged at 1565707405652 (10:43:25 GMT-0400 (EDT))
[XCUITest] Setting up real device
[XCUITest] Calling: 'ios-deploy --exists --id f1bbe847a1fc129e93a1fe5d91d94a16134dfadf --bundle_id com.foo.bar'
[XCUITest] Stdout: '[....] Waiting for iOS device to be connected
[XCUITest] [....] Using f1bbe847a1fc129e93a1fe5d91d94a16134dfadf (D10AP, iPhone 7, iphoneos, arm64) a.k.a. 'iPhone'.
[XCUITest] true
[XCUITest] '
[XCUITest] Using WDA path: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent'
[XCUITest] Using WDA agent: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj'
[XCUITest] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
[XCUITest] Starting WebDriverAgent initialization with the synchronization key 'XCUITestDriver'
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[WD Proxy] Got an unexpected response: {"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":8100}
[XCUITest] WDA is not listening at 'http://localhost:8100/'
[XCUITest] WDA is currently not running. There is nothing to cache
[XCUITest] Trying to start WebDriverAgent 1 times with 10000ms interval
[XCUITest] These values can be customized by changing wdaStartupRetries/wdaStartupRetryInterval capabilities
[BaseDriver] Event 'wdaStartAttempted' logged at 1565707406113 (10:43:26 GMT-0400 (EDT))
[XCUITest] Launching WebDriverAgent on the device
[XCUITest] Carthage found: '/usr/local/bin/carthage'
[XCUITest] Running WebDriverAgent bootstrap script to install dependencies
[XCUITest] Fetching dependencies
[XCUITest] *** Checking out RoutingHTTPServer at "v1.0.2"
[XCUITest] *** Checking out CocoaAsyncSocket at "7.6.3"
[XCUITest] *** Checking out YYCache at "1.1.0"
[XCUITest] *** xcodebuild output can be found in /var/folders/wk/h21zqjfs76n3dy222tpmb_nm0000gn/T/carthage-xcodebuild.X1eCxa.log
[XCUITest] *** Downloading CocoaAsyncSocket.framework binary at "Version 7.6.3"
[XCUITest] *** Building scheme "RoutingHTTPServer tvOS" in RoutingHTTPServer.xcodeproj
[XCUITest] Failed to write to /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Carthage/Build/tvOS/RoutingHTTPServer.framework: Error Domain=NSCocoaErrorDomain Code=260 "The file “RoutingHTTPServer.framework” couldn’t be opened because there is no such file." UserInfo={NSURL=file:///Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Carthage/Checkouts/RoutingHTTPServer/build/ArchiveIntermediates/RoutingHTTPServer%20tvOS/BuildProductsPath/Release-appletvos/RoutingHTTPServer.framework, NSFilePath=/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Carthage/Checkouts/RoutingHTTPServer/build/ArchiveIntermediates/RoutingHTTPServer tvOS/BuildProductsPath/Release-appletvos/RoutingHTTPServer.framework, NSUnderlyingError=0x7fb2b8321ea0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
[XCUITest] Launching WebDriverAgent on the device
[XCUITest] Carthage found: '/usr/local/bin/carthage'
[XCUITest] Running WebDriverAgent bootstrap script to install dependencies
[XCUITest] Fetching dependencies
[XCUITest] *** Checking out RoutingHTTPServer at "v1.0.2"
[XCUITest] *** Checking out YYCache at "1.1.0"
[XCUITest] *** Checking out CocoaAsyncSocket at "7.6.3"
[XCUITest] *** Downloading CocoaAsyncSocket.framework binary at "Version 7.6.3"
[XCUITest] *** xcodebuild output can be found in /var/folders/wk/h21zqjfs76n3dy222tpmb_nm0000gn/T/carthage-xcodebuild.VyONZN.log
[XCUITest] *** Building scheme "RoutingHTTPServer tvOS" in RoutingHTTPServer.xcodeproj
[XCUITest] Failed to write to /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Carthage/Build/tvOS/RoutingHTTPServer.framework: Error Domain=NSCocoaErrorDomain Code=260 "The file “RoutingHTTPServer.framework” couldn’t be opened because there is no such file." UserInfo={NSURL=file:///Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Carthage/Checkouts/RoutingHTTPServer/build/ArchiveIntermediates/RoutingHTTPServer%20tvOS/BuildProductsPath/Release-appletvos/RoutingHTTPServer.framework, NSFilePath=/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Carthage/Checkouts/RoutingHTTPServer/build/ArchiveIntermediates/RoutingHTTPServer tvOS/BuildProductsPath/Release-appletvos/RoutingHTTPServer.framework, NSUnderlyingError=0x7fa980d2c910 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
[BaseDriver] Event 'wdaStartFailed' logged at 1565707446235 (10:44:06 GMT-0400 (EDT))
[XCUITest] Unable to launch WebDriverAgent because of xcodebuild failure: Command 'Scripts/bootstrap.sh -d' exited with code 1. Make sure you follow the tutorial at {link removed}. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
[XCUITest] Quitting and uninstalling WebDriverAgent
[XCUITest] Shutting down sub-processes
[XCUITest] Removing WDA application from device
[XCUITest] Error: Unable to launch WebDriverAgent because of xcodebuild failure: Command 'Scripts/bootstrap.sh -d' exited with code 1. Make sure you follow the tutorial at {link removed}. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
[XCUITest]     at quitAndUninstall (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:501:15)
[XCUITest] Parsed BUILD_DIR configuration value: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/build'
[XCUITest] Got derived data root: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver'
[XCUITest] Not clearing log files. Use `clearSystemFiles` capability to turn on.
[iOSLog] Stopping iOS log capture
[BaseDriver] Event 'newSessionStarted' logged at 1565707448695 (10:44:08 GMT-0400 (EDT))
[MJSONWP] Encountered internal error running command: Error: Unable to launch WebDriverAgent because of xcodebuild failure: Command 'Scripts/bootstrap.sh -d' exited with code 1. Make sure you follow the tutorial at {link removed}. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
[MJSONWP]     at quitAndUninstall (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:501:15)
[HTTP] <-- POST /wd/hub/session 500 43655 ms - 488
[HTTP] 
[HTTP] --> DELETE /wd/hub/session
[HTTP] {}
[HTTP] No route found. Setting content type to 'text/plain'
[HTTP] <-- DELETE /wd/hub/session 404 3 ms - 57
[HTTP] 

I have attempted to make sure this is not a Carthage issue, and have re-installed and re-linked carthage. Also this app is downloaded from TestFlight so it is not a production app.

[XCUITest] Failed to write to /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Carthage/Build/tvOS/RoutingHTTPServer.framework: Error Domain=NSCocoaErrorDomain Code=260 “The file “RoutingHTTPServer.framework” couldn’t be opened because there is no such file.” UserInfo={NSURL=file:///Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Carthage/Checkouts/RoutingHTTPServer/build/ArchiveIntermediates/RoutingHTTPServer%20tvOS/BuildProductsPath/Release-appletvos/RoutingHTTPServer.framework, NSFilePath=/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Carthage/Checkouts/RoutingHTTPServer/build/ArchiveIntermediates/RoutingHTTPServer tvOS/BuildProductsPath/Release-appletvos/RoutingHTTPServer.framework, NSUnderlyingError=0x7fb2b8321ea0 {Error Domain=NSPOSIXErrorDomain Code=2 “No such file or directory”}}

According to the message, carthage command failed.

I have attempted to make sure this is not a Carthage issue,

Do you mean you already tried to run Scripts/bootstrap.sh -d in /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/, and it worked? If so, maybe you should make sure the permission.

This command fails to execute with

*** Building scheme “RoutingHTTPServer tvOS” in RoutingHTTPServer.xcodeproj
Failed to write to /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Carthage/Build/tvOS/RoutingHTTPServer.framework: Error Domain=NSCocoaErrorDomain Code=260 “The file “RoutingHTTPServer.framework” couldn’t be opened because there is no such file.” UserInfo={NSURL=file:///Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Carthage/Checkouts/RoutingHTTPServer/build/ArchiveIntermediates/RoutingHTTPServer%20tvOS/BuildProductsPath/Release-appletvos/RoutingHTTPServer.framework, NSFilePath=/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Carthage/Checkouts/RoutingHTTPServer/build/ArchiveIntermediates/RoutingHTTPServer tvOS/BuildProductsPath/Release-appletvos/RoutingHTTPServer.framework, NSUnderlyingError=0x7fbed5c60ab0 {Error Domain=NSPOSIXErrorDomain Code=2 “No such file or directory”}}