[INST STDERR] dyld: could not load inserted library

Prerequisites:-
Xcode version: 7.1
Appium version: 1.4.13
iOS simulator: Platform version :9.1
App Build: .zip format

  1. I have upgraded Xcod version from 6.4 to 7.1 and appium version from 1.4.8 ot 1.4.13.
  2. After that I have configured iOS simulator related configuration in IOS settings.
  3. I have started the appium server and I am getting below defined error log.

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 “9.1” --platform-name “iOS” --app “/Users/al/work/Sample_app.zip” --show-ios-log --device-name “iPhone 6 Plus”

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/al/work/Sample_app.zip
info: [debug] Copying local zip to tmp dir

info: [debug] /Users/al/work/Sample_app.zip copied to /var/folders/7g/_4s8f5kx4cs1875_psp3rps00000gn/T/115930-707-iouf8v/appium-app.zip

info: [debug] Unzipping /var/folders/7g/_4s8f5kx4cs1875_psp3rps00000gn/T/115930-707-iouf8v/appium-app.zip

info: [debug] Testing zip archive: /var/folders/7g/_4s8f5kx4cs1875_psp3rps00000gn/T/115930-707-iouf8v/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/115930-707-iouf8v/Sample_app.app

info: [debug] Creating new appium session 496c0576-d8b4-41ca-b316-96d5188a5193
info: [debug] Removing any remaining instruments sockets
info: [debug] Cleaned up instruments socket /tmp/instruments_sock
info: [debug] Setting Xcode version

info: [debug] Xcode version set to 7.1

info: [debug] Setting iOS SDK Version

info: [debug] iOS SDK Version set to 9.1

info: [debug] Checking whether instruments supports our device string

info: [debug] Getting list of devices instruments supports

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

info: [debug] Getting device string from opts: {“forceIphone”:false,“forceIpad”:false,“xcodeVersion”:“7.1”,“iOSSDKVersion”:“9.1”,“deviceName”:“iPhone 6 Plus”,“platformVersion”:“9.1”}

info: [debug] fixDevice is on
info: [debug] Final device string is: ‘iPhone 6 Plus (9.1)’
info: [debug] iOS sim UDID is E7924EEC-3584-448A-A3AB-597095A28BA5
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/al/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/submodules/appium-uiauto/bin/command-proxy-client.js",“instrumentsSock”:"/tmp/instruments_sock",“interKeyDelay”:null,“justLoopInfinitely”:false,“autoAcceptAlerts”:false,“autoDismissAlerts”:false,“sendKeyStrategy”:“oneByOne”}

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

info: [debug] Dynamic bootstrap path: /Users/al/Library/Application Support/appium/bootstrap/bootstrap-f062718992d59810.js
info: [debug] Reusing dynamic bootstrap: /Users/al/Library/Application Support/appium/bootstrap/bootstrap-f062718992d59810.js

info: [debug] Getting device string from opts: {“forceIphone”:false,“forceIpad”:false,“xcodeVersion”:“7.1”,“iOSSDKVersion”:“9.1”,“deviceName”:“iPhone 6 Plus”,“platformVersion”:“9.1”}
info: [debug] fixDevice is on
info: [debug] Final device string is: ‘iPhone 6 Plus (9.1)’
info: [debug] We’re on iOS7.1+ so forcing defaultDevice on
info: [debug] Getting device string from opts: {“forceIphone”:false,“forceIpad”:false,“xcodeVersion”:“7.1”,“iOSSDKVersion”:“9.1”,“deviceName”:“iPhone 6 Plus”,“platformVersion”:“9.1”}
info: [debug] fixDevice is on
info: [debug] Final device string is: ‘iPhone 6 Plus (9.1)’
info: [debug] Parsed app Info.plist (as binary)

info: [debug] Wrote new app Info.plist with device type
info: [debug] Checking whether we need to set app preferences
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: [debug] Cleaning sim data files

info: node-simctl: Executing: xcrun with args: simctl erase E7924EEC-3584-448A-A3AB-597095A28BA5 and timeout: 2000

info: [debug] Cleaning app data files

warn: Applications directory /Users/al/Library/Developer/CoreSimulator/Devices/E7924EEC-3584-448A-A3AB-597095A28BA5/data/Containers/Data/Application doesn’t exist. Have you run this simulator before?
warn: Applications directory /Users/al/Library/Developer/CoreSimulator/Devices/E7924EEC-3584-448A-A3AB-597095A28BA5/data/Containers/Bundle/Application doesn’t exist. Have you run this simulator before?

info: Couldn’t find app directories to delete. Probably it’s not installed
info: [debug] Not setting locale
info: [debug] No iOS / app preferences to set
info: [debug] Starting iOS 8.* simulator log capture

info: [debug] Not pre-launching simulator

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 iPhone 6 Plus (9.1)
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 “iPhone 6 Plus (9.1)” “/var/folders/7g/_4s8f5kx4cs1875_psp3rps00000gn/T/115930-707-iouf8v/.app” -e UIASCRIPT “/Users/al/Library/Application Support/appium/bootstrap/bootstrap-f062718992d59810.js” -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {“DYLD_INSERT_LIBRARIES”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib",“LIB_PATH”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7"}
info: [debug] And launch timeouts (in ms): {“global”:90000}

[INST STDERR] dyld: could not load inserted library ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib’ because no suitable image found. Did find:
/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib: mmap() error 1 at address=0x105F8A000, size=0x00001000 segment=__TEXT in Segment::map() mapping /Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib

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

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

I think you are facing this issue:

See if the suggestions there help.

I am having a simular issue. I created a issue on github for it.

@wreed and @uscengineer, I have ticked the native library in the Advanced settings in iOS settings. Now, it works fine.

Thanks Selvi! This saved my ass! Instruments was crashing when running my automation from code and I could not figure out why! I’d forgotten that I’d set use “–native-instruments-lib” in Advanced settings on the Appium iOS client, but was not doing this in code. So, when setting up the server I included the following argument:

command.addArgument("–native-instruments-lib", true);

And now all works fine!

Phew!

Thanks all!

LVC

How to set command.addArgument("–native-instruments-lib", true); in code