[Instruments] Error launching instruments: Instruments crashed on startup

Hi,
I’m trying to run Appium desktop app with an iOS simulator, for running web application on Safari from a testNG test.

Environment:
Appium Desktop: Version 1.3.0 (1.3.0)
Xcode: 7.3.1
Mac OS: 10.11.6 (El Capitan)

Script:

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, “iPhone 5”);
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, “iOS”);
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, “9.3”);
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, “Safari”);
URL url = new URL(“http://127.0.0.1:4723/wd/hub”);
AppiumDriver driver = new AppiumDriver(url, capabilities);
driver.get(“https://www.google.com/”);

When I start the Appium session, the simulator starts and opens Safari, but after the Appium timeout (90 seconds), kills the simulator process. Then Appium launches another instance of itself, starts the simulator again, kills it, and repeats this cycle until I force-quit all the Appium processes.

[HTTP] → POST /wd/hub/session {“desiredCapabilities”:{“browserName”:“Safari”,“deviceName”:“iPhone 5”,“platformName”:“iOS”,“platformVersion”:“9.3”},“capabilities”:{“desiredCapabilities”:{“browserName”:“Safari”,“deviceName”:“iPhone 5”,“platformName”:“iOS”,“platformVersion”:“9.3”},“firstMatch”:[{“browserName”:“Safari”,“platformName”:“ios”}]}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{“browserName”:“Safari”,“deviceName”:“iPhone 5”,“platformName”:“iOS”,“platformVersion”:“9.3”},null,{“desiredCapabilities”:{“browserName”:“Safari”,“deviceName”:“iPhone 5”,“platformName”:“iOS”,“platformVersion”:“9.3”},“firstMatch”:[{“browserName”:“Safari”,“platformName”:“ios”}]}]
[BaseDriver] Event ‘newSessionRequested’ logged at 1524690302919 (23:05:02 GMT+0200 (CEST))
[Appium] Merged W3C capabilities {“desiredCapabilities”:{“browserName”:“Safari”,… into desiredCapabilities object {“browserName”:“Safari”,“deviceName”:“iPhone 5”…
[Appium] Creating new IosDriver (v1.29.0) session
[Appium] Capabilities:
[Appium] browserName: Safari
[Appium] deviceName: iPhone 5
[Appium] platformName: ios
[Appium] platformVersion: 9.3
[BaseDriver] Session created with session id: 645b83b6-02ef-4031-83c9-f06c04472c2c
[iOS] Xcode version set to 7.3.1
[iOS] Not auto-detecting udid.
[iOS] We are on iOS8+ so not copying Safari app
[iOS] Removing any remaining instruments sockets
[iOS] Cleaned up instruments socket /var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/instruments_sock
[iOS] Setting iOS SDK Version
[iOS] iOS SDK Version set to 9.3
[Instruments] Getting list of devices instruments supports
[Instruments] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
[Instruments] Available devices: Apple TV 1080p (9.2) [728BD903-4C28-46A1-A98D-25ABD349B062] (Simulator),iPad 2 (9.3) [9D971CB9-3A90-4955-BC60-1977CEA73F3A] (Simulator),iPad Air (9.3) [9EA4AFE0-83BF-40BD-B170-443A0FEF4C4F] (Simulator),iPad Air 2 (9.3) [E2AE4CC2-3542-4AE7-88CA-E0EFA3F43538] (Simulator),iPad Pro (9.3) [92D177DF-A371-4D48-8B41-E8C484C04822] (Simulator),iPad Retina (9.3) [C6F51EA8-AAAC-4346-ADCF-1889F6385331] (Simulator),iPhone 4s (9.3) [63441CED-784E-411C-9F36-35752B4EA28D] (Simulator),iPhone 5 (9.3) [96336116-C7B6-48C2-A37A-F94FF0188DD1] (Simulator),iPhone 5s (9.3) [5F085CD1-3D00-4898-8AA1-711074E3BE5E] (Simulator),iPhone 6 (9.3) [6197563A-4E0B-47DA-B115-A2E426412C3F] (Simulator),iPhone 6 Plus (9.3) [73C0FAC1-D9A6-4309-A56C-B277FFCAF37A] (Simulator),iPhone 6s (9.3) [D4D9BF8A-4D6B-490F-B508-A4DE5FF93369] (Simulator),iPhone 6s (9.3) + Apple Watch - 38mm (2.2) [19B32C74-07EC-499C-80EC-48978BFF9D2D] (Simulator),iPhone 6s Plus (9.3) [6D747777-BB19-4D65-A7C1-FF75FBBDB24D] (Simulator),iPhone 6s Plus (9.3) + Apple Watch - 42mm (2.2) [C054B097-97C3-4C1B-A917-C65447234E79] (Simulator)
[iOS] Checking whether our device string is supported
[iOSSim] Retrieving device name string for Xcode version 7.3.1
[iOSSim] Getting device string from options: {“deviceName”:“iPhone 5”,“platformVersion”:“9.3”,“forceIphone”:false,“forceIpad”:false}
[iOSSim] Final device string is ‘iPhone 5 (9.3)’
[iOS] iOS sim UDID is 96336116-C7B6-48C2-A37A-F94FF0188DD1
[iOSSim] Constructing iOS simulator for Xcode version 7.3.1 with udid ‘96336116-C7B6-48C2-A37A-F94FF0188DD1’
[iOS] Localizable.strings is not currently supported when using real devices.
[iOS] Creating instruments
[UIAuto] Preparing bootstrap code
[UIAuto] Dynamic bootstrap dir: /Users/sasanapu/Library/Application Support/appium/bootstrap
[UIAuto] Dynamic env: {“nodePath”:“/Applications/Appium.app/Contents/MacOS/Appium”,“commandProxyClientPath”:“/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-ios-driver/build/lib/uiauto/bin/command-proxy-client.js”,“instrumentsSock”:“/var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/instruments_sock”,“interKeyDelay”:null,“justLoopInfinitely”:false,“autoAcceptAlerts”:false,“autoDismissAlerts”:false,“sendKeyStrategy”:“oneByOne”}
[UIAuto] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!

[UIAuto] Dynamic bootstrap path: /Users/sasanapu/Library/Application Support/appium/bootstrap/bootstrap-427d2d771160b3c6.js
[UIAuto] Reusing dynamic bootstrap: /Users/sasanapu/Library/Application Support/appium/bootstrap/bootstrap-427d2d771160b3c6.js
[iOS] User specified default device, letting instruments launch it
[iOS] Running ios sim reset flow
[iOS] Killing the simulator
[iOSSim] Killing all iOS Simulators
[iOSSim] Using fkill to kill processes: 29653
[iOS] Cleaning sim state.
[iOS] No reason to set locale
[iOS] No iOS / app preferences to set
[iOSLog] Starting iOS 9.3 simulator log capture
[iOSLog] System log path: /Users/sasanapu/Library/Logs/CoreSimulator/96336116-C7B6-48C2-A37A-F94FF0188DD1/system.log
[iOS] Not pre-launching simulator
[iOS] Starting UIAutoClient, and launching Instruments.
[UIAuto] Instruments socket server started at /var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/instruments_sock
[Instruments] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
[Instruments] Attempting to launch instruments, this is try #1
[Instruments] Launching instruments
[Instruments] Attempting to run app on iPhone 5 (9.3)
[Instruments] On xcode 7.0+, instruments-without-delay does not work, skipping instruments-without-delay
[Instruments] Found Insruments-Without-Delay: /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-ios-driver/instruments-iwd/iwd7
[Instruments] Spawning instruments with command: ‘/Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/appium-instruments/instrumentscli0.trace -w “iPhone 5 (9.3)” com.apple.mobilesafari -e UIASCRIPT “/Users/sasanapu/Library/Application Support/appium/bootstrap/bootstrap-427d2d771160b3c6.js” -e UIARESULTSPATH /var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/appium-instruments’
[Instruments] And launch timeouts (in ms): {“global”:90000}
[Instruments] [INST] Waiting for device to boot…
[Instruments] [INST] 2018-04-25 21:05:35 +0000 Error: Script threw an uncaught JavaScript error: JSON Parse error: Expected ‘]’ on line 2681 of bootstrap-427d2d771160b3c6.js
[Instruments] [INST] 2018-04-25 21:05:35 +0000 Stopped: Script was stopped by the user
[Instruments] [INST STDERR] 2018-04-25 23:05:35.410 instruments[34814:381196] Attempting to change event horizon while disengage
[Instruments] [INST] Instruments Trace Complete (Duration : 23.544989s; Output : /var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/appium-instruments/instrumentscli0.trace)
[Instruments] Instruments exited with code: 0
[Instruments] Error launching instruments: Instruments crashed on startup
[iOSSim] Killing all iOS Simulators
[iOSSim] Using fkill to kill processes: 34818
[HTTP] ← POST /wd/hub/session - - ms - -
[Instruments] Attempting to launch instruments, this is try #2
[Instruments] Launching instruments
[Instruments] Attempting to run app on iPhone 5 (9.3)
[Instruments] On xcode 7.0+, instruments-without-delay does not work, skipping instruments-without-delay
[Instruments] Found Insruments-Without-Delay: /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-ios-driver/instruments-iwd/iwd7
[Instruments] Spawning instruments with command: ‘/Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/appium-instruments/instrumentscli0.trace -w “iPhone 5 (9.3)” com.apple.mobilesafari -e UIASCRIPT “/Users/sasanapu/Library/Application Support/appium/bootstrap/bootstrap-427d2d771160b3c6.js” -e UIARESULTSPATH /var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/appium-instruments’
[Instruments] And launch timeouts (in ms): {“global”:90000}
[Instruments] [INST] Waiting for device to boot…
[Instruments] [INST] 2018-04-25 21:06:40 +0000 Error: Script threw an uncaught JavaScript error: JSON Parse error: Expected ‘]’ on line 2681 of bootstrap-427d2d771160b3c6.js
[Instruments] [INST] 2018-04-25 21:06:40 +0000 Stopped: Script was stopped by the user
[Instruments] [INST STDERR] 2018-04-25 23:06:41.022 instruments[34947:384461] Attempting to change event horizon while disengage
[Instruments] [INST] Instruments Trace Complete (Duration : 53.689709s; Output : /var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/appium-instruments/instrumentscli0.trace)
[Instruments] Instruments exited with code: 0
[Instruments] Error launching instruments: Instruments crashed on startup
[iOSSim] Killing all iOS Simulators
[iOSSim] Using fkill to kill processes: 34951
[Instruments] Attempting to launch instruments, this is try #3
[Instruments] Launching instruments
[Instruments] Attempting to run app on iPhone 5 (9.3)
[Instruments] On xcode 7.0+, instruments-without-delay does not work, skipping instruments-without-delay
[Instruments] Found Insruments-Without-Delay: /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-ios-driver/instruments-iwd/iwd7
[Instruments] Spawning instruments with command: ‘/Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/appium-instruments/instrumentscli0.trace -w “iPhone 5 (9.3)” com.apple.mobilesafari -e UIASCRIPT “/Users/sasanapu/Library/Application Support/appium/bootstrap/bootstrap-427d2d771160b3c6.js” -e UIARESULTSPATH /var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/appium-instruments’
[Instruments] And launch timeouts (in ms): {“global”:90000}
[Instruments] [INST] Waiting for device to boot…
[Instruments] [INST] 2018-04-25 21:07:17 +0000 Error: Script threw an uncaught JavaScript error: JSON Parse error: Expected ‘]’ on line 2681 of bootstrap-427d2d771160b3c6.js
[Instruments] [INST] 2018-04-25 21:07:17 +0000 Stopped: Script was stopped by the user
[Instruments] [INST STDERR] 2018-04-25 23:07:17.743 instruments[35065:384739] Attempting to change event horizon while disengage
[Instruments] [INST] Instruments Trace Complete (Duration : 23.075102s; Output : /var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/appium-instruments/instrumentscli0.trace)
[Instruments] Instruments exited with code: 0
[Instruments] Error launching instruments: Instruments crashed on startup
[iOSSim] Killing all iOS Simulators
[iOSSim] Using fkill to kill processes: 35069
[Instruments] Attempting to launch instruments, this is try #4
[Instruments] Launching instruments
[Instruments] Attempting to run app on iPhone 5 (9.3)
[Instruments] On xcode 7.0+, instruments-without-delay does not work, skipping instruments-without-delay
[Instruments] Found Insruments-Without-Delay: /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-ios-driver/instruments-iwd/iwd7
[Instruments] Spawning instruments with command: ‘/Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/appium-instruments/instrumentscli0.trace -w “iPhone 5 (9.3)” com.apple.mobilesafari -e UIASCRIPT “/Users/sasanapu/Library/Application Support/appium/bootstrap/bootstrap-427d2d771160b3c6.js” -e UIARESULTSPATH /var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/appium-instruments’
[Instruments] And launch timeouts (in ms): {“global”:90000}
[Instruments] [INST] Waiting for device to boot…
[Instruments] [INST] 2018-04-25 21:07:55 +0000 Error: Script threw an uncaught JavaScript error: JSON Parse error: Expected ‘]’ on line 2681 of bootstrap-427d2d771160b3c6.js
[Instruments] [INST] 2018-04-25 21:07:55 +0000 Stopped: Script was stopped by the user
[Instruments] [INST STDERR] 2018-04-25 23:07:55.882 instruments[35184:387832] Attempting to change event horizon while disengage
[Instruments] [INST] Instruments Trace Complete (Duration : 24.855623s; Output : /var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/appium-instruments/instrumentscli0.trace)
[Instruments] Instruments exited with code: 0
[Instruments] Error launching instruments: Instruments crashed on startup
[iOSSim] Killing all iOS Simulators
[iOSSim] Using fkill to kill processes: 35188
[Instruments] Attempting to launch instruments, this is try #5
[Instruments] Launching instruments
[Instruments] Attempting to run app on iPhone 5 (9.3)
[Instruments] On xcode 7.0+, instruments-without-delay does not work, skipping instruments-without-delay
[Instruments] Found Insruments-Without-Delay: /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-ios-driver/instruments-iwd/iwd7
[Instruments] Spawning instruments with command: ‘/Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/appium-instruments/instrumentscli0.trace -w “iPhone 5 (9.3)” com.apple.mobilesafari -e UIASCRIPT “/Users/sasanapu/Library/Application Support/appium/bootstrap/bootstrap-427d2d771160b3c6.js” -e UIARESULTSPATH /var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/appium-instruments’
[Instruments] And launch timeouts (in ms): {“global”:90000}
[Instruments] [INST] Waiting for device to boot…
[Instruments] [INST] 2018-04-25 21:08:29 +0000 Error: Script threw an uncaught JavaScript error: JSON Parse error: Expected ‘]’ on line 2681 of bootstrap-427d2d771160b3c6.js
[Instruments] [INST] 2018-04-25 21:08:29 +0000 Stopped: Script was stopped by the user
[Instruments] [INST STDERR] 2018-04-25 23:08:29.819 instruments[35320:389220] Attempting to change event horizon while disengage
[Instruments] [INST] Instruments Trace Complete (Duration : 21.841841s; Output : /var/folders/wj/yq8mcx_x2cv4c5kdh57cqrxxk7tx2j/T/appium-instruments/instrumentscli0.trace)
[Instruments] Instruments exited with code: 0
[Instruments] Error launching instruments: Instruments crashed on startup
[Instruments] Error: We exceeded the number of retries allowed for instruments to successfully start; failing launch
at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:69:13)
at Instruments.launch$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-ios-driver/lib/instruments/instruments.js:228:15)
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 throw] (/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: We exceeded the number of retries allowed for instruments to successfully start; failing launch
at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:69:13)
at Instruments.launch$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-ios-driver/lib/instruments/instruments.js:228:15)
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 throw] (/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
[MJSONWP] Encountered internal error running command: Error: We exceeded the number of retries allowed for instruments to successfully start; failing launch
at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:69:13)
at Instruments.launch$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-ios-driver/lib/instruments/instruments.js:228:15)
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 throw] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke

I went through a lot of your forum issues, but couldn’t find a solution to resolve this issue.
I do have UIAutomation enabled on the emulator.

I’m not sure what went wrong. Can you please help me fix it.