Simulator opening and closing immediately for XCUITest

Simulator is opening and closing immediately, below is the error log. Please help me some one what could be the issue.

[XCUITest] Error: Command ‘/bin/bash Scripts/bootstrap.sh -d’ exited with code 1
at ChildProcess. (…/…/lib/teen_process.js:66:19)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Socket. (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:498:12)
{ Error: Command ‘/bin/bash Scripts/bootstrap.sh -d’ exited with code 1
at ChildProcess. (…/…/lib/teen_process.js:66:19)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Socket. (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:498:12)
stdout: ‘\u001b[1mFetching dependencies\n*** Downloading peertalk.framework binary at “v1.0”\n’,
stderr: ‘Failed to write to /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Carthage/Build/iOS: Error Domain=NSCocoaErrorDomain Code=513 “You don’t have permission to save the file “iOS” in the folder “Build”.” UserInfo={NSFilePath=/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Carthage/Build/iOS, NSUnderlyingError=0x7feadb5a1c20 {Error Domain=NSPOSIXErrorDomain Code=13 “Permission denied”}}\n’,

Did you build your App for a Real Device or Simulator?

If you built the app for a Real Device, try building it for a Simulator and retry.

I am trying it for the Browser from Simulator not Real Device.

I think this is your issue:

But you don’t give Xcode version, Appium version, etc., so it’s hard to tell.

Hi Wreed, I am trying following code:
DesiredCapabilities capabilities = new DesiredCapabilities ();
capabilities.setCapability(MobileCapabilityType.APPIUM_VERSION, “1.6.3”);
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, “ios”);
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, “10.2”);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, “iphone simulator”);
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, “safari”);
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, “XCUITEST”);
driver=new IOSDriver(new URL(“http://127.0.0.1:4723/wd/hub”),capabilities);

driver.get(“myurl”);

it is opening the simulator but closing with error.

Did you click the link? Did you read the solution? Posting your capabilities is a funny way of solving your problem when no one asked for that.

Right in the log message you posted are some items such as…

'Failed to write to /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Carthage/Build/iOS
You don’t have permission to save the file “iOS” in the folder “Build”
"Permission denied"

What user are you starting the appium server as, and do they have permissions on that directory?

Thank you for the update.