Could not pre-launch appium: Error: Instruments crashed on startup

  1. I need to inspect an iOS app in appium inspector using real iphone device.

  2. I am using 1.4.8 as appium version, physical device as iphone 6 and platform version as 8.3.

  3. I have enabled Enable UI Automation option under Developer option settings.

  4. I have given the following parameters in iOS settings menu.
    4.1 App path: .zip format
    4.2 Platform Version: 8.3
    4.3 Force Device: iPhone 6
    4.4 UDID: for that specific device If I start appium server, I am getting the below log message.

  5. I really got struck with this problem.

Error Log:-

Launching Appium with command: ‘/Applications/Appium
.app/Contents/Resources/node/bin/node’ lib/server/main.js
–command-timeout “7200” --pre-launch --debug-log-spacing
–platform-version “8.3” --platform-name “iOS” --app
“/Users/valar/work/sample_App.zip” --udid
“4a9b4ad142c7f308bfd3217d2fae43f9a4bc8e00” --show-ios-log --device-name
“iPhone 6”

info: [debug] Starting Appium in pre-launch mode

info: Pre-launching app

info: *************************************

info: *************************************

info: *************************************

info: *************************************

info: *************************************

info: *************************************

info: *************************************

info: *************************************

info: **** NEW SESSION ***

info: **** NEW SESSION ***

info: **** NEW SESSION ***

info: **** NEW SESSION ***

info: **** NEW SESSION ***

info: **** NEW SESSION ***

info: **** NEW SESSION ***

info: **** NEW SESSION ***

info: *************************************

info: *************************************

info: *************************************

info: *************************************

info: *************************************

info: *************************************

info: *************************************

info: *************************************

info: [debug] Using local .zip from command line: /Users/valar/work/sample_App.zip

info: [debug] Copying local zip to tmp dir

info: [debug] /Users/valar/work/sample_App.zip copied to
/var/folders/7g/_4s8f5kx4cs1875_psp3rps00000gn/T/115725-3663-1b0sdz4/appium-app.zip

info: [debug] Unzipping /var/folders/7g/_4s8f5kx4cs1875_psp3rps00000gn/T/115725-3663-1b0sdz4/appium-app.zip

info: [debug] Testing zip archive: /var/folders/7g/_4s8f5kx4cs1875_psp3rps00000gn/T/115725-3663-1b0sdz4/appium-app.zip

info: [debug] Zip archive tested clean

info: [debug] Unzip successful

info: [debug] Using locally extracted app: /var/folders/7g/_4s8f5kx4cs1875_psp3rps00000gn/T/115725-3663-1b0sdz4/sample_App.app

info: [debug] Creating new appium session ab360b32-08b6-4f6b-889e-78fe9a6b88f3

info: [debug] Removing any remaining instruments sockets

info: [debug] Cleaned up instruments socket /tmp/instruments_sock

info: [debug] Auto-detecting iOS udid…

info: [debug] Not auto-detecting udid, running on sim

info: [debug] Parsed app Info.plist (as binary)

info: [debug] Parsed app Localizable.strings

info: [debug] Getting bundle ID from app

info: [debug] Parsed app Info.plist (as binary)

info: [debug] Creating instruments

info: [debug] Preparing uiauto bootstrap

info: [debug] Dynamic bootstrap dir: /Users/valar/Library/Application Support/appium/bootstrap

info: [debug] Dynamic env: {“nodePath”:"/Applications/Appium
.app/Contents/Resources/node/bin/node",“commandProxyClientPath”:"/Applications/Appium

.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js",“instrumentsSock”:"/tmp/instruments_sock",“interKeyDelay”:null,“justLoopInfinitely”:false,“autoAcceptAlerts”:false,“autoDismissAlerts”:false,“sendKeyStrategy”:“grouped”}

info: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!

info: [debug] Dynamic bootstrap path: /Users/valar/Library/Application Support/appium/bootstrap/bootstrap-f2765f8569503e7c.js

info: [debug] Reusing dynamic bootstrap: /Users/valar/Library/Application Support/appium/bootstrap/bootstrap-f2765f8569503e7c.js

info: [debug] Attempting iOS device log capture via libimobiledevice idevicesyslog

info: [debug] Creating iDevice object with udid 4a9b4ad142c7f308bfd3217d2fae43f9a4bc8e00

info: [IOS_SYSLOG_ROW ] Aug 25 11:37:49 iPhone-6 syslog_relay[177] : syslog_relay found the ASL prompt. Starting…

info: [debug] App is installed.

info: [debug] fullReset not requested. No need to install.

info: [debug] Starting command proxy.

info: [debug] Instruments socket server started at /tmp/instruments_sock

info: [debug] Starting instruments

info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments

info: Launching instruments

info: [debug] Attempting to run app on real device with UDID 4a9b4ad142c7f308bfd3217d2fae43f9a4bc8e00

info: [debug] 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 /tmp/appium-instruments/instrumentscli0.trace -w
4a9b4ad142c7f308bfd3217d2fae43f9a4bc8e00 com.company.iphone. sample_App
-e UIASCRIPT “/Users/valar/Library/Application
Support/appium/bootstrap/bootstrap-f2765f8569503e7c.js” -e
UIARESULTSPATH /tmp/appium-instruments

info: [debug] And extra without-delay env: {}

info: [debug] And launch timeouts (in ms): {“global”:90000}

info: [debug] [INSTSERVER] Instruments exited with code 253

info: [debug] Killall instruments

info: [debug] Instruments crashed on startup

info: [debug] Attempting to retry launching instruments, this is retry #1

info: [debug] Killall iOS Simulator

info: [IOS_SYSLOG_ROW ] Aug 25 11:37:50 iPhone-6 DTMobileIS[191] : Could
not create service named
com.apple.instruments.server.services.processcontrol.posixspawn

info: [IOS_SYSLOG_ROW ] Aug 25 11:37:50 iPhone-6 DTMobileIS[191] : Could
not create service named
com.apple.instruments.server.services.launchdaemon

info: [IOS_SYSLOG_ROW ] Aug 25 11:37:50 iPhone-6
notification_proxy[175] : 0x100494000 -[MNPLockdownConnection
receiveMessage]: lockdown_receive_message error!

info: [IOS_SYSLOG_ROW ] Aug 25 11:37:50 iPhone-6
notification_proxy[175] : 0x100494000 -[MNPLockdownConnection
receiveMessage]: lockdown_receive_message error!

info: [IOS_SYSLOG_ROW ] Aug 25 11:37:52 iPhone-6 locationd[61] : Location icon should now be in state ‘Active’

info: [IOS_SYSLOG_ROW ] Aug 25 11:37:53 iPhone-6 CLTM[20] : CLTM: _subscription 0x0, _subscribedChannels 0x0

info: [IOS_SYSLOG_ROW ] Aug 25 11:37:55 iPhone-6 sample_App[151] :
NewRelic(4.186,0x174675e80): NRTimer.m:94 -[NRTimer
timeElapsedInSeconds]

info: [IOS_SYSLOG_ROW ] NRMATimer has a negative duration: 1440482874430.621094 => 0.000000

info: Launching instruments

info: [debug] Attempting to run app on real device with UDID 4a9b4ad142c7f308bfd3217d2fae43f9a4bc8e00

info: [debug] 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 /tmp/appium-instruments/instrumentscli0.trace -w
4a9b4ad142c7f308bfd3217d2fae43f9a4bc8e00 com.company.iphone.sample_App
-e UIASCRIPT “/Users/valar/Library/Application
Support/appium/bootstrap/bootstrap-f2765f8569503e7c.js” -e
UIARESULTSPATH /tmp/appium-instruments

info: [debug] And extra without-delay env: {}

info: [debug] And launch timeouts (in ms): {“global”:90000}

info: [debug] [INSTSERVER] Instruments exited with code 253

info: [debug] Killall instruments

info: [debug] Instruments crashed on startup

info: [debug] Attempting to retry launching instruments, this is retry #2

info: [debug] Killall iOS Simulator

info: [IOS_SYSLOG_ROW ] Aug 25 11:37:56 iPhone-6 DTMobileIS[191] : Could
not create service named
com.apple.instruments.server.services.launchdaemon

info: [IOS_SYSLOG_ROW ] Aug 25 11:37:56 iPhone-6 DTMobileIS[191] : Could
not create service named
com.apple.instruments.server.services.processcontrol.posixspawn

info: [IOS_SYSLOG_ROW ] Aug 25 11:37:56 iPhone-6 notification_proxy[175]
: 0x100384000 -[MNPLockdownConnection receiveMessage]:
lockdown_receive_message error!

info: [IOS_SYSLOG_ROW ] Aug 25 11:37:56 iPhone-6 notification_proxy[175]
: 0x100384000 -[MNPLockdownConnection receiveMessage]:
lockdown_receive_message error!

info: [IOS_SYSLOG_ROW ] Aug 25 11:37:58 iPhone-6 CLTM[20] : CLTM: _subscription 0x0, _subscribedChannels 0x0

info: [IOS_SYSLOG_ROW ] Aug 25 11:38:01 iPhone-6 sample_App151] :
NewRelic(4.186,0x17487e440): NRTimer.m:94 -[NRTimer
timeElapsedInSeconds]

info: [IOS_SYSLOG_ROW ] NRMATimer has a negative duration: 1440482880235.167969 => 0.000000

info: Launching instruments

info: [debug] Attempting to run app on real device with UDID 4a9b4ad142c7f308bfd3217d2fae43f9a4bc8e00

info: [debug] 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 /tmp/appium-instruments/instrumentscli0.trace -w
4a9b4ad142c7f308bfd3217d2fae43f9a4bc8e00 com.company.iphone. sample_App
-e UIASCRIPT “/Users/valar/Library/Application
Support/appium/bootstrap/bootstrap-f2765f8569503e7c.js” -e
UIARESULTSPATH /tmp/appium-instruments

info: [debug] And extra without-delay env: {}

info: [debug] And launch timeouts (in ms): {“global”:90000}

info: [debug] [INSTSERVER] Instruments exited with code 253

info: [debug] Killall instruments

info: [debug] Instruments crashed on startup

info: [debug] Attempting to retry launching instruments, this is retry #3

info: [debug] Killall iOS Simulator

info: [IOS_SYSLOG_ROW ] Aug 25 11:38:02 iPhone-6 DTMobileIS[191] : Could
not create service named
com.apple.instruments.server.services.processcontrol.posixspawn

info: [IOS_SYSLOG_ROW ] Aug 25 11:38:02 iPhone-6 DTMobileIS[191] : Could
not create service named
com.apple.instruments.server.services.launchdaemon

info: [IOS_SYSLOG_ROW ] Aug 25 11:38:02 iPhone-6
notification_proxy[175] : 0x10040c000 -[MNPLockdownConnection
receiveMessage]: lockdown_receive_message error!

info: [IOS_SYSLOG_ROW ] Aug 25 11:38:02 iPhone-6
notification_proxy[175] : 0x10040c000 -[MNPLockdownConnection
receiveMessage]: lockdown_receive_message error!

info: [IOS_SYSLOG_ROW ] Aug 25 11:38:02 iPhone-6 locationd[61] : Location icon should now be in state ‘Region Monitoring’

info: [IOS_SYSLOG_ROW ] Aug 25 11:38:03 iPhone-6 CLTM[20] : CLTM: _subscription 0x0, _subscribedChannels 0x0

info: [IOS_SYSLOG_ROW ] Aug 25 11:38:07 iPhone-6 sample_App[151] :
NewRelic(4.186,0x174675e80): NRTimer.m:94 -[NRTimer
timeElapsedInSeconds]

info: [IOS_SYSLOG_ROW ] NRMATimer has a negative duration: 1440482886151.112061 => 0.000000

info: Launching instruments

info: [debug] Attempting to run app on real device with UDID 4a9b4ad142c7f308bfd3217d2fae43f9a4bc8e00

info: [debug] 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 /tmp/appium-instruments/instrumentscli0.trace -w
4a9b4ad142c7f308bfd3217d2fae43f9a4bc8e00 com.company.iphone. sample_App
-e UIASCRIPT “/Users/valar/Library/Application
Support/appium/bootstrap/bootstrap-f2765f8569503e7c.js” -e
UIARESULTSPATH /tmp/appium-instruments

info: [debug] And extra without-delay env: {}

info: [debug] And launch timeouts (in ms): {“global”:90000}

info: [debug] [INSTSERVER] Instruments exited with code 253

info: [debug] Killall instruments

info: [debug] Instruments crashed on startup

info: [debug] We exceeded the number of retries allowed for instruments to successfully start; failing launch

info: [debug] Stopping iOS log capture

info: [debug] Running ios sim reset flow

info: [debug] Killing the simulator process

info: [debug] Killing any other simulator daemons

info: [debug] Killall iOS Simulator

info: [IOS_SYSLOG_ROW ] Aug 25 11:38:07 iPhone-6 DTMobileIS[191] : Could
not create service named
com.apple.instruments.server.services.launchdaemon

info: [IOS_SYSLOG_ROW ] Aug 25 11:38:07 iPhone-6 DTMobileIS[191] : Could
not create service named
com.apple.instruments.server.services.processcontrol.posixspawn

info: [debug] On a real device; cannot clean device state

info: [debug] Cleaning up appium session

error: Could not pre-launch appium: Error: Instruments crashed on startup

@Appium_Master, I got struck with above problem for a long time. Still, I can’t find the solution to inspect the iOS app using real iOS device. Can you provide the solution for this above issue?

are you able to do the same thing with simulators ?

@Appium_Master, Ya I can able to inspect the iOS app in iOS simulator. But, the same iOS app, When I tried to inspect using real iOS physical device, I am getting above issue. Please provide the solution for above issue.

@Appium_Master, I am waiting for your response, still i don’t find any solution to this problem. please help me.

@Appium_Master, I am facing same issue till, will you please give me solution? I got struck with this for a long time.

Hey there:

This line seems like your culprit:
nfo: [IOS_SYSLOG_ROW ] Aug 25 11:37:50 iPhone-6 DTMobileIS[191] : Could
not create service named
com.apple.instruments.server.services.launchdaemon

2 things to try:

  1. Settings > developer > enable ui automation
  2. Your device may not be enabled for development. In Xcode open developer tool > instruments > automation > pick your device > click use for development when prompted

Good luck!

1 Like

No good luck. Even I am facing the same error and performed above steps but no hope

@Rock
This issue got resolved for me. I will explain the steps which I have done.
Go to Xcode ->Click Open Developer Tools-> Click Instruments->In
top of the Instruments tab you can find Choose a profiling
template(Choose your iPhone device)->Select Automation->Click
Choose button->Click the Play button.

In Appium ->iOS settings->go to Advanced settings->tick the Native instrument library.
Go to Appium and start the server.

Now your app get installed successfully in device.

1 Like

@Selvi_Ranganathan

Thanks… will try for the same