Cannot launch Appium server on iPhone 5

Appium Version: 1.4.13
Mac OS X: 10.11.4
Device: iPhone5 / iOS 9.3
Xcode Version: 7.3 + Command Line Tools.

The Appium Server can not launch on the specified device, I am using a correctly signed app from the developer, my device has all the correct provisioning profiles and I have ideviceinstaller and UIAutomation enabled from Developer Options. Here is the Log from Appium:

Launching Appium with command: ‘/Applications/Appium.app/Contents/Resources/node/bin/node’ lib/server/main.js --command-timeout “7200” --pre-launch --debug-log-spacing --log-timestamp --local-timezone --platform-version “9.2” --platform-name “iOS” --app “com.youlocal” --udid “7fda0c435c99d4debeee813e325fb33e4f3d5c03” --show-ios-log --show-ios-log --device-name “iPhone 5” --launch-timeout “900000” --native-instruments-lib

2016-03-31 11:11:12:661 - info: [debug] Starting Appium in pre-launch mode

2016-03-31 11:11:12:664 - info: Pre-launching app

2016-03-31 11:11:12:666 - info: *************************************
2016-03-31 11:11:12:666 - info: *************************************
2016-03-31 11:11:12:666 - info: *************************************
2016-03-31 11:11:12:666 - info: *************************************
2016-03-31 11:11:12:666 - info: *************************************
2016-03-31 11:11:12:667 - info: *************************************
2016-03-31 11:11:12:667 - info: *************************************
2016-03-31 11:11:12:667 - info: *************************************
2016-03-31 11:11:12:667 - info: **** NEW SESSION ***
2016-03-31 11:11:12:667 - info: **** NEW SESSION ***
2016-03-31 11:11:12:667 - info: **** NEW SESSION ***
2016-03-31 11:11:12:668 - info: **** NEW SESSION ***
2016-03-31 11:11:12:668 - info: **** NEW SESSION ***
2016-03-31 11:11:12:668 - info: **** NEW SESSION ***
2016-03-31 11:11:12:668 - info: **** NEW SESSION ***
2016-03-31 11:11:12:668 - info: **** NEW SESSION ***
2016-03-31 11:11:12:669 - info: *************************************

2016-03-31 11:11:12:670 - info: *************************************
2016-03-31 11:11:12:670 - info: *************************************
2016-03-31 11:11:12:670 - info: *************************************
2016-03-31 11:11:12:671 - info: *************************************
2016-03-31 11:11:12:671 - info: *************************************
2016-03-31 11:11:12:671 - info: *************************************
2016-03-31 11:11:12:671 - info: *************************************
2016-03-31 11:11:12:676 - info: [debug] App is an iOS bundle, will attempt to run as pre-existing
2016-03-31 11:11:12:677 - info: [debug] Creating new appium session d3b5288a-7937-469d-b42c-a93fae6b836b

2016-03-31 11:11:12:679 - info: [debug] Removing any remaining instruments sockets
2016-03-31 11:11:12:681 - info: [debug] Cleaned up instruments socket /tmp/instruments_sock
2016-03-31 11:11:12:681 - info: [debug] Auto-detecting iOS udid…
2016-03-31 11:11:12:681 - info: [debug] Not auto-detecting udid, running on sim
2016-03-31 11:11:12:682 - info: [debug] Could not parse plist file (as binary) at /Applications/Appium.app/Contents/Resources/node_modules/appium/com.youlocal/en.lproj/Localizable.strings
2016-03-31 11:11:12:682 - info: Will try to parse the plist file as XML
2016-03-31 11:11:12:683 - info: [debug] Could not parse plist file (as XML) at /Applications/Appium.app/Contents/Resources/node_modules/appium/com.youlocal/en.lproj/Localizable.strings
2016-03-31 11:11:12:683 - warn: Could not parse app Localizable.strings assuming it doesn’t exist
2016-03-31 11:11:12:683 - info: [debug] Creating instruments
2016-03-31 11:11:12:684 - info: [debug] Preparing uiauto bootstrap
2016-03-31 11:11:12:684 - info: [debug] Dynamic bootstrap dir: /Users/nikolaynedyalkov/Library/Application Support/appium/bootstrap
2016-03-31 11:11:12:685 - info: [debug] Dynamic env: {“nodePath”:"/Applications/Appium.app/Contents/Resources/node/bin/node",“commandProxyClientPath”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-uiauto/bin/command-proxy-client.js",“instrumentsSock”:"/tmp/instruments_sock",“interKeyDelay”:null,“justLoopInfinitely”:false,“autoAcceptAlerts”:false,“autoDismissAlerts”:false,“sendKeyStrategy”:“grouped”}

2016-03-31 11:11:12:696 - info: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!

2016-03-31 11:11:12:696 - info: [debug] Dynamic bootstrap path: /Users/nikolaynedyalkov/Library/Application Support/appium/bootstrap/bootstrap-5923cadea0343e3f.js
2016-03-31 11:11:12:699 - info: [debug] Reusing dynamic bootstrap: /Users/nikolaynedyalkov/Library/Application Support/appium/bootstrap/bootstrap-5923cadea0343e3f.js
2016-03-31 11:11:12:701 - info: [debug] Attempting iOS device log capture via libimobiledevice idevicesyslog

2016-03-31 11:11:12:892 - info: [debug] Creating iDevice object with udid 7fda0c435c99d4debeee813e325fb33e4f3d5c03

2016-03-31 11:11:15:535 - info: [IOS_SYSLOG_ROW ] Mar 31 11:11:14 iPhone syslog_relay[1431] : syslog_relay read 51 total bytes:

2016-03-31 11:11:15:535 - info: [IOS_SYSLOG_ROW ] ========================
2016-03-31 11:11:15:535 - info: [IOS_SYSLOG_ROW ] ASL is here to serve you

2016-03-31 11:11:15:543 - info: [IOS_SYSLOG_ROW ] Mar 31 11:11:14 iPhone syslog_relay[1431] : syslog_relay found the ASL prompt. Starting…

2016-03-31 11:11:16:426 - info: [debug] App is installed.

2016-03-31 11:11:16:426 - info: [debug] fullReset not requested. No need to install.
2016-03-31 11:11:16:426 - info: [debug] Starting command proxy.

2016-03-31 11:11:16:430 - info: [debug] Instruments socket server started at /tmp/instruments_sock
2016-03-31 11:11:16:431 - info: [debug] Starting instruments

2016-03-31 11:11:16:500 - info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments

2016-03-31 11:11:16:501 - info: Launching instruments

2016-03-31 11:11:16:503 - info: [debug] Attempting to run app on real device with UDID 7fda0c435c99d4debeee813e325fb33e4f3d5c03
2016-03-31 11:11:16:504 - 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 7fda0c435c99d4debeee813e325fb33e4f3d5c03 com.youlocal -e UIASCRIPT “/Users/nikolaynedyalkov/Library/Application Support/appium/bootstrap/bootstrap-5923cadea0343e3f.js” -e UIARESULTSPATH /tmp/appium-instruments
2016-03-31 11:11:16:504 - info: [debug] And extra without-delay env: {}
2016-03-31 11:11:16:504 - info: [debug] And launch timeouts (in ms): {“global”:900000}

2016-03-31 11:11:18:906 - info: [debug] [INST STDERR] 2016-03-31 11:11:18.905 instruments[5338:396662] Connection peer refused channel request for “com.apple.instruments.server.services.capabilities”; channel canceled <DTXChannel: 0x7fde25e3c020>

2016-03-31 11:11:18:906 - info: [IOS_SYSLOG_ROW ] Mar 31 11:11:19 iPhone kernel[0] : socketIsClosed sock_receive returned errno 54
2016-03-31 11:11:18:907 - info: [debug] [INST STDERR] 2016-03-31 11:11:18.905 instruments[5338:396662] Connection peer refused channel request for “com.apple.instruments.server.services.device.xpccontrol”; channel canceled <DTXChannel: 0x7fde236bbe80>
2016-03-31 11:11:18.905 instruments[5338:396662] Connection peer refused channel request for “com.apple.instruments.server.services.deviceinfo”; channel canceled <DTXChannel: 0x7fde236a7400>
2016-03-31 11:11:18.906 instruments[5338:396662] Connection peer refused channel request for “com.apple.instruments.server.services.processcontrol”; channel canceled <DTXChannel: 0x7fde236a79e0>
2016-03-31 11:11:18.906 instruments[5338:396662] Connection peer refused channel request for “com.apple.instruments.server.services.processcontrol.posixspawn”; channel canceled <DTXChannel: 0x7fde236a70b0>
2016-03-31 11:11:18.906 instruments[5338:396662] Connection peer refused channel request for “com.apple.instruments.server.services.mobilenotifications”; channel canceled <DTXChannel: 0x7fde236a7fa0>
2016-03-31 11:11:18.906 instruments[5338:396662] Connection peer refused channel request for “com.apple.instruments.server.services.device.applictionListing”; channel canceled <DTXChannel: 0x7fde2377ce90>
2016-03-31 11:11:18.906 instruments[5338:396662] Connection peer refused channel request for “com.apple.dt.Xcode.WatchProcessControl”; channel canceled <DTXChannel: 0x7fde2377f020>
2016-03-31 11:11:18:907 - info: [debug] [INST STDERR] 2016-03-31 11:11:18.907 instruments[5338:396653] Connection peer refused channel request for “com.apple.instruments.server.services.wireless”; channel canceled <DTXChannel: 0x7fde2377faf0>
Instruments Usage Error: Specified target process is invalid: com.youlocal
instruments, version 7.3 (60133)
usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument …]]]

2016-03-31 11:11:18:923 - info: [debug] [INSTSERVER] Instruments exited with code 255
2016-03-31 11:11:18:924 - info: [debug] Killall instruments
2016-03-31 11:11:18:927 - info: [debug] Instruments crashed on startup
2016-03-31 11:11:18:927 - info: [debug] Attempting to retry launching instruments, this is retry #1
2016-03-31 11:11:18:928 - info: [debug] Killall iOS Simulator
2016-03-31 11:11:18:939 - info: [IOS_SYSLOG_ROW ] Mar 31 11:11:19 iPhone notification_proxy[1405] : 0x40081000 -[MNPLockdownConnection receiveMessage]: lockdown_receive_message error!

2016-03-31 11:11:19:053 - info: [IOS_SYSLOG_ROW ] Mar 31 11:11:19 iPhone gputoolsd[1567] : schedule invalidation <DYTransport 0x17542b20, error: lost transport connection (31)>

2016-03-31 11:11:19:067 - info: [IOS_SYSLOG_ROW ] Mar 31 11:11:19 iPhone gputoolsd[1567] : terminating daemon 0x175428d0

2016-03-31 11:11:23:934 - info: Launching instruments

2016-03-31 11:11:23:935 - info: [debug] Attempting to run app on real device with UDID 7fda0c435c99d4debeee813e325fb33e4f3d5c03

2016-03-31 11:11:23:935 - 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 7fda0c435c99d4debeee813e325fb33e4f3d5c03 com.youlocal -e UIASCRIPT “/Users/nikolaynedyalkov/Library/Application Support/appium/bootstrap/bootstrap-5923cadea0343e3f.js” -e UIARESULTSPATH /tmp/appium-instruments
2016-03-31 11:11:23:936 - info: [debug] And extra without-delay env: {}
2016-03-31 11:11:23:936 - info: [debug] And launch timeouts (in ms): {“global”:900000}

2016-03-31 11:11:25:512 - info: [debug] [INST STDERR] 2016-03-31 11:11:25.512 instruments[5344:396728] WebKit Threading Violation - initial use of WebKit from a secondary thread.

2016-03-31 11:11:26:023 - info: [debug] [INST STDERR] Instruments Usage Error: Specified target process is invalid: com.youlocal
instruments, version 7.3 (60133)
usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument …]]]

2016-03-31 11:11:26:035 - info: [debug] [INSTSERVER] Instruments exited with code 255

2016-03-31 11:11:26:036 - info: [debug] Killall instruments
2016-03-31 11:11:26:038 - info: [debug] Instruments crashed on startup
2016-03-31 11:11:26:039 - info: [debug] Attempting to retry launching instruments, this is retry #2
2016-03-31 11:11:26:039 - info: [debug] Killall iOS Simulator
2016-03-31 11:11:26:045 - info: [IOS_SYSLOG_ROW ] Mar 31 11:11:26 iPhone gputoolsd[1568] : schedule invalidation <DYTransport 0x1564bbd0, error: lost transport connection (31)>
2016-03-31 11:11:26:046 - info: [IOS_SYSLOG_ROW ] Mar 31 11:11:26 iPhone gputoolsd[1568] : terminating daemon 0x1564b990

2016-03-31 11:11:26:086 - info: [IOS_SYSLOG_ROW ] Mar 31 11:11:26 iPhone notification_proxy[1405] : 0x40081000 -[MNPLockdownConnection receiveMessage]: lockdown_receive_message error!

2016-03-31 11:11:26:086 - info: [IOS_SYSLOG_ROW ] Mar 31 11:11:26 iPhone notification_proxy[1405] : 0x40081000 -[MNPLockdownConnection receiveMessage]: lockdown_receive_message error!

2016-03-31 11:11:31:045 - info: Launching instruments

2016-03-31 11:11:31:045 - info: [debug] Attempting to run app on real device with UDID 7fda0c435c99d4debeee813e325fb33e4f3d5c03
2016-03-31 11:11:31:045 - 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 7fda0c435c99d4debeee813e325fb33e4f3d5c03 com.youlocal -e UIASCRIPT “/Users/nikolaynedyalkov/Library/Application Support/appium/bootstrap/bootstrap-5923cadea0343e3f.js” -e UIARESULTSPATH /tmp/appium-instruments
2016-03-31 11:11:31:046 - info: [debug] And extra without-delay env: {}
2016-03-31 11:11:31:046 - info: [debug] And launch timeouts (in ms): {“global”:900000}

2016-03-31 11:11:32:742 - info: [debug] [INST STDERR] 2016-03-31 11:11:32.741 instruments[5350:396790] Connection peer refused channel request for “com.apple.instruments.server.services.capabilities”; channel canceled <DTXChannel: 0x7fc0f5e1db20>
2016-03-31 11:11:32:742 - info: [debug] [INST STDERR] 2016-03-31 11:11:32.742 instruments[5350:396790] Connection peer refused channel request for “com.apple.instruments.server.services.device.xpccontrol”; channel canceled <DTXChannel: 0x7fc0f5d2f310>
2016-03-31 11:11:32.742 instruments[5350:396790] Connection peer refused channel request for “com.apple.instruments.server.services.deviceinfo”; channel canceled <DTXChannel: 0x7fc0f5971900>
2016-03-31 11:11:32.742 instruments[5350:396790] Connection peer refused channel request for “com.apple.instruments.server.services.processcontrol”; channel canceled <DTXChannel: 0x7fc0f5d01260>
2016-03-31 11:11:32.742 instruments[5350:396790] Connection peer refused channel request for “com.apple.instruments.server.services.processcontrol.posixspawn”; channel canceled <DTXChannel: 0x7fc0f5973200>
2016-03-31 11:11:32.742 instruments[5350:396790] Connection peer refused channel request for “com.apple.instruments.server.services.mobilenotifications”; channel canceled <DTXChannel: 0x7fc0f5d010f0>
2016-03-31 11:11:32:743 - info: [debug] [INST STDERR] 2016-03-31 11:11:32.742 instruments[5350:396790] Connection peer refused channel request for “com.apple.instruments.server.services.device.applictionListing”; channel canceled <DTXChannel: 0x7fc0f5d061b0>
2016-03-31 11:11:32:743 - info: [debug] [INST STDERR] 2016-03-31 11:11:32.743 instruments[5350:396790] Connection peer refused channel request for “com.apple.dt.Xcode.WatchProcessControl”; channel canceled <DTXChannel: 0x7fc0f5d3b580>
2016-03-31 11:11:32.743 instruments[5350:396788] Connection peer refused channel request for “com.apple.instruments.server.services.wireless”; channel canceled <DTXChannel: 0x7fc0f5d3c1a0>
Instruments Usage Error: Specified target process is invalid: com.youlocal
instruments, version 7.3 (60133)
usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument …]]]

2016-03-31 11:11:32:744 - info: [IOS_SYSLOG_ROW ] Mar 31 11:11:32 iPhone kernel[0] : socketIsClosed sock_receive returned errno 54

2016-03-31 11:11:32:756 - info: [debug] [INSTSERVER] Instruments exited with code 255
2016-03-31 11:11:32:756 - info: [debug] Killall instruments
2016-03-31 11:11:32:760 - info: [debug] Instruments crashed on startup
2016-03-31 11:11:32:760 - info: [debug] Attempting to retry launching instruments, this is retry #3
2016-03-31 11:11:32:761 - info: [debug] Killall iOS Simulator
2016-03-31 11:11:32:766 - info: [IOS_SYSLOG_ROW ] Mar 31 11:11:32 iPhone gputoolsd[1569] : schedule invalidation <DYTransport 0x155484e0, error: lost transport connection (31)>
2016-03-31 11:11:32:768 - info: [IOS_SYSLOG_ROW ] Mar 31 11:11:32 iPhone gputoolsd[1569] : terminating daemon 0x155482a0
2016-03-31 11:11:32:772 - info: [IOS_SYSLOG_ROW ] Mar 31 11:11:32 iPhone lockdownd[1183] : failed to get host service connection - invalid socket

2016-03-31 11:11:32:848 - info: [IOS_SYSLOG_ROW ] Mar 31 11:11:32 iPhone notification_proxy[1405] : 0x40197000 -[MNPLockdownConnection receiveMessage]: lockdown_receive_message error!

2016-03-31 11:11:37:763 - info: Launching instruments

2016-03-31 11:11:37:764 - info: [debug] Attempting to run app on real device with UDID 7fda0c435c99d4debeee813e325fb33e4f3d5c03
2016-03-31 11:11:37:764 - 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 7fda0c435c99d4debeee813e325fb33e4f3d5c03 com.youlocal -e UIASCRIPT “/Users/nikolaynedyalkov/Library/Application Support/appium/bootstrap/bootstrap-5923cadea0343e3f.js” -e UIARESULTSPATH /tmp/appium-instruments
2016-03-31 11:11:37:764 - info: [debug] And extra without-delay env: {}
2016-03-31 11:11:37:765 - info: [debug] And launch timeouts (in ms): {“global”:900000}

2016-03-31 11:11:39:339 - info: [debug] [INST STDERR] 2016-03-31 11:11:39.338 instruments[5356:396931] WebKit Threading Violation - initial use of WebKit from a secondary thread.

2016-03-31 11:11:39:712 - info: [IOS_SYSLOG_ROW ] Mar 31 11:11:39 iPhone kernel[0] : socketIsClosed sock_receive returned errno 54

2016-03-31 11:11:39:715 - info: [debug] [INST STDERR] 2016-03-31 11:11:39.713 instruments[5356:396901] Connection peer refused channel request for “com.apple.instruments.server.services.capabilities”; channel canceled <DTXChannel: 0x7f9e8c560790>
2016-03-31 11:11:39.713 instruments[5356:396901] Connection peer refused channel request for “com.apple.instruments.server.services.device.xpccontrol”; channel canceled <DTXChannel: 0x7f9e8c629e00>
2016-03-31 11:11:39.713 instruments[5356:396901] Connection peer refused channel request for “com.apple.instruments.server.services.deviceinfo”; channel canceled <DTXChannel: 0x7f9e8c60c310>
2016-03-31 11:11:39.714 instruments[5356:396901] Connection peer refused channel request for “com.apple.instruments.server.services.processcontrol”; channel canceled <DTXChannel: 0x7f9e89f4be80>
2016-03-31 11:11:39.714 instruments[5356:396901] Connection peer refused channel request for “com.apple.instruments.server.services.processcontrol.posixspawn”; channel canceled <DTXChannel: 0x7f9e89f7c370>
2016-03-31 11:11:39.714 instruments[5356:396901] Connection peer refused channel request for “com.apple.instruments.server.services.mobilenotifications”; channel canceled <DTXChannel: 0x7f9e89f7c610>
2016-03-31 11:11:39.714 instruments[5356:396901] Connection peer refused channel request for “com.apple.instruments.server.services.device.applictionListing”; channel canceled <DTXChannel: 0x7f9e8c6335b0>
2016-03-31 11:11:39:715 - info: [debug] [INST STDERR] 2016-03-31 11:11:39.714 instruments[5356:396901] Connection peer refused channel request for “com.apple.dt.Xcode.WatchProcessControl”; channel canceled <DTXChannel: 0x7f9e8c6351e0>
2016-03-31 11:11:39.715 instruments[5356:396903] Connection peer refused channel request for “com.apple.instruments.server.services.wireless”; channel canceled <DTXChannel: 0x7f9e89f7ce40>
Instruments Usage Error: Specified target process is invalid: com.youlocal
instruments, version 7.3 (60133)
usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument …]]]

2016-03-31 11:11:39:727 - info: [debug] [INSTSERVER] Instruments exited with code 255
2016-03-31 11:11:39:728 - info: [debug] Killall instruments
2016-03-31 11:11:39:731 - info: [debug] Instruments crashed on startup
2016-03-31 11:11:39:731 - info: [debug] We exceeded the number of retries allowed for instruments to successfully start; failing launch
2016-03-31 11:11:39:732 - info: [debug] Stopping iOS log capture
2016-03-31 11:11:39:733 - info: [debug] Running ios sim reset flow
2016-03-31 11:11:39:734 - info: [debug] Killing the simulator process
2016-03-31 11:11:39:736 - info: [debug] Killing any other simulator daemons
2016-03-31 11:11:39:740 - info: [debug] Killall iOS Simulator
2016-03-31 11:11:39:754 - info: [IOS_SYSLOG_ROW ] Mar 31 11:11:39 iPhone gputoolsd[1570] : schedule invalidation <DYTransport 0x17e77f20, error: lost transport connection (31)>

2016-03-31 11:11:39:782 - info: [debug] On a real device; cannot clean device state

2016-03-31 11:11:39:783 - error: Could not pre-launch appium: Error: Instruments crashed on startup

When I install the app from Xcode manually and run it from the device, it starts fine.

Here is the setup from the Appium GUI:

I have followed the official documentation step by step and I can Launch it successfully on simulator. The same setup even launches succesfully on that device sometimes, but most of the times I get this error.

Anyone has suggestions of what could be the cause for the “Error: Instruments crashed on startup” message and why can’t the Appium server launch the app on the real device?

Change this to the path where the .ipa file lives.

This just changes if the app is freshly installed when running the Appium server or if it’s using the already installed app with the matching proccess, in this case “com.youlocal”.
Anyway, I found it useful to restart the device and make sure that the device is done syncing in itunes when connecting, before running the server.

Ok, that’s good to know.