Error: Could not initialize ideviceinstaller; make sure it is installed and works on your system

When we run the server via appium GUI all is fine however when we try to run it via code it fails
with the “Could not initialize ideviceinstaller” error (see log below).
Below is the code we use:
AppiumDriverLocalService service = AppiumDriverLocalService. buildDefaultService ();
service.start();
driver = new IOSDriver(new URL(“http://0.0.0.0:4723/wd/hub”), capabilities);
Any idea what is the root cause & solution for it?
=======================

[TestNG] Running:
/Users/sgmacbookpro/Appium/Projects/SG_iOS_Automation/src/resources/Testng.xml

[Appium] Welcome to Appium v1.5.1 (REV ee51200036dac07568da29b8aa88c0335ea6a514)
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> GET /wd/hub/status {}
[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.5.1”,“revision”:“ee51200036dac07568da29b8aa88c0335ea6a514”}}
[HTTP] <-- GET /wd/hub/status 200 19 ms - 121
[HTTP] --> POST /wd/hub/session {“desiredCapabilities”:{“app”:"/Users/sgmacbookpro/Appium/iOS/SkyGiraffe.app",“noReset”:“true”,“newCommandTimeout”:12000,“automationName”:“Appium”,“udid”:“51d8c712258a5b0ac63516aa5be9d10014b0c270”,“platformName”:“iOS”,“deviceName”:“SG iPhone 5s”,“autoAcceptAlerts”:“True”}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{“app”:"/Users/sgmacbookpro/Appium/iOS/SkyGiraffe.app",“noReset”:“true”,“newCommandTimeout”:12000,“automationName”:“Appium”,“udid”:“51d8c712258a5b…
[Appium] Creating new IosDriver session
[Appium] Capabilities:
[Appium] app: ‘/Users/sgmacbookpro/Appium/iOS/SkyGiraffe.app’
[Appium] noReset: ‘true’
[Appium] newCommandTimeout: 12000
[Appium] automationName: ‘Appium’
[Appium] udid: ‘51d8c712258a5b0ac63516aa5be9d10014b0c270’
[Appium] platformName: ‘iOS’
[Appium] deviceName: ‘SG iPhone 5s’
[Appium] autoAcceptAlerts: ‘True’
[BaseDriver] Capability ‘noReset’ changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Capability ‘autoAcceptAlerts’ changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Session created with session id: 54b426a1-0c1e-400f-9125-12163bb96d6d
[debug] [iOS] Not auto-detecting udid.
[BaseDriver] Using local app ‘/Users/sgmacbookpro/Appium/iOS/SkyGiraffe.app’
[debug] [iOS] Removing any remaining instruments sockets
[debug] [iOS] Cleaned up instruments socket /var/folders/wz/bmlkwsw57jbbmyk7dgyxhwd80000gn/T/instruments_sock
[debug] [iOS] No language specified. Using default strings
[debug] [iOS] Strings file not found. Looking in ‘en.lproj’ directory
[iOS] Could not file localizable strings file ‘Localizable.strings’!
[debug] [ios-app-utils] Getting bundle ID from app
[iOS] Extracted bundleID: beta.SkyGiraffe.SkyGiraffe from app: /Users/sgmacbookpro/Appium/iOS/SkyGiraffe.app
[debug] [iOS] Creating instruments
[debug] [UIAuto] Preparing bootstrap code
[debug] [UIAuto] Dynamic bootstrap dir: /Users/sgmacbookpro/Library/Application Support/appium/bootstrap
[debug] [UIAuto] Dynamic env: {“nodePath”:”/usr/local/Cellar/node/0.12.4/bin/node",“commandProxyClientPath”:"/usr/local/lib/node_modules/appium/node_modules/appium-ios-driver/node_modules/appium-uiauto/build/lib/bin/command-proxy-client.js",“instrumentsSock”:"/var/folders/wz/bmlkwsw57jbbmyk7dgyxhwd80000gn/T/instruments_sock",“interKeyDelay”:null,“justLoopInfinitely”:false,“autoAcceptAlerts”:true,“autoDismissAlerts”:false,“sendKeyStrategy”:“grouped”}
[debug] [UIAuto] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!

[debug] [UIAuto] Dynamic bootstrap path: /Users/sgmacbookpro/Library/Application Support/appium/bootstrap/bootstrap-4a14a46e94948c95.js
[debug] [UIAuto] Reusing dynamic bootstrap: /Users/sgmacbookpro/Library/Application Support/appium/bootstrap/bootstrap-4a14a46e94948c95.js
[debug] [iOS] Reset not set, not ending real device
[debug] [iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog
[iOSLog] Could not capture device log using libimobiledevice idevicesyslog. Libimobiledevice is probably not installed
[debug] [iOSLog] Attempting iOS device log capture via deviceconsole
[iOS] Could not capture logs from device. Continuing without capturing logs.
[debug] [iOS] Creating iDevice object with udid 51d8c712258a5b0ac63516aa5be9d10014b0c270
[debug] [iOS] Couldn’t find ideviceinstaller, trying built-in at /usr/local/lib/node_modules/appium/node_modules/build/libimobiledevice-macosx/ideviceinstaller
[iOS] Could not initialize ideviceinstaller; make sure it is installed and works on your system
[MJSONWP] Encountered internal error running command: Error: Could not initialize ideviceinstaller; make sure it is installed and works on your system
at IosDriver.getIDeviceObj (lib/driver.js:372:15)
at IosDriver.installToRealDevice$ (lib/driver.js:320:28)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at enqueueResult (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:185:17)
at new Promise (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:197:7)
at AsyncIterator.enqueue (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:184:16)
at AsyncIterator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at Object.runtime.async (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:209:12)
at IosDriver.installToRealDevice (lib/driver.js:344:16)
at IosDriver.startRealDevice$ (lib/driver.js:308:16)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at run (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:104:47)
at /usr/local/lib/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:115:28
at flush (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/$.microtask.js:19:5)
at process._tickCallback (node.js:355:11)
[HTTP] <-- POST /wd/hub/session 500 221 ms - 226

Have you tried installing ideviceinstaller?

http://brewformulas.org/Ideviceinstaller

Yes ideviceinstaller is installed.

Please refer
ideviceinstaller: “Could not initialize ideviceinstaller” #4584

@menypeled

Please try below steps and see what happens.

Just a workaround for those who need it when facing same issue.

  1. Open terminal from your Mac and enter the command:
    printf “%s\n” $PATH
    –>The purpose is to print the current setting for you Mac’s path

  2. Get the value from the Terminal out put. In my case was:
    /usr/local/bin:/usr/bin:/usr/sbin:/sbin

  3. Right click on the execution.java file in Eclipse then choose [Run Configuration]

  4. Click to tab [Environment] then click on [New]

    • Name: PATH
    • Value: /usr/local/bin:/usr/bin:/usr/sbin:/sbin
  5. Apply then run

I went back and read the OP, but I’m not seeing that they are using Eclipse. Hopefully they are because your solution is a good one in that case.

Thanks!

What do you mean execution.java file?

@menypeled
I used java so I just wrote it down as an example.
In your case, it will be the file that contains the code to start Appium Server as you mentioned “however when we try to run it via code it fails”

We are running the tests via TestNG (Via XMl file).
I tried the suggested configuration however it didn’t work…

@menypeled
It’s not related to the framework that you are using.

Could you possibly tell me the value after you [quote=“menypeled, post:9, topic:11699”]
printf “%s\n” $PATH
[/quote] in you mac’s terminal?

If you’re running the code from IDE, so which IDE that you are using? Eclipse…?

We are using eclipse.
Path:
/Users/sgmacbookpro/apache-maven-3.3.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

@menypeled
Can you open terminal and enter: find / -name ideviceinstaller

Please give me the terminal output.

Last login: Fri Aug 19 08:14:59 on ttys000
SGMacBookPROs-MacBook-Pro:~ sgmacbookpro$ find / -name ideviceinstaller
find: /.DocumentRevisions-V100: Permission denied
find: /.fseventsd: Permission denied
find: /.MobileBackups: Permission denied
find: /.Spotlight-V100: Permission denied
find: /.Trashes: Permission denied
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
find: /Library/Application Support/Apple/ParentalControls/Users: Permission denied
find: /Library/Application Support/ApplePushService: Permission denied
find: /Library/Application Support/com.apple.TCC: Permission denied
find: /Library/Caches/com.apple.iconservices.store: Permission denied
find: /Library/Caches/com.google.SoftwareUpdate.0: Permission denied
find: /private/etc/cups/certs: Permission denied
find: /private/var/agentx: Permission denied
find: /private/var/at/tabs: Permission denied
find: /private/var/at/tmp: Permission denied
find: /private/var/audit: Permission denied
find: /private/var/backups: Permission denied
find: /private/var/db/caches/opendirectory: Permission denied
find: /private/var/db/ConfigurationProfiles/Setup: Permission denied
find: /private/var/db/dhcpclient: Permission denied
find: /private/var/db/diagnostics: Permission denied
find: /private/var/db/dslocal/nodes/Default: Permission denied
find: /private/var/db/geod: Permission denied
find: /private/var/db/launchd.db/com.apple.launchd.peruser.0: Permission denied
find: /private/var/db/launchd.db/com.apple.launchd.peruser.200: Permission denied
find: /private/var/db/launchd.db/com.apple.launchd.peruser.202: Permission denied
find: /private/var/db/launchd.db/com.apple.launchd.peruser.205: Permission denied
find: /private/var/db/launchd.db/com.apple.launchd.peruser.212: Permission denied
find: /private/var/db/launchd.db/com.apple.launchd.peruser.26: Permission denied
find: /private/var/db/launchd.db/com.apple.launchd.peruser.4294967294: Permission denied
find: /private/var/db/launchd.db/com.apple.launchd.peruser.503: Permission denied
find: /private/var/db/launchd.db/com.apple.launchd.peruser.55: Permission denied
find: /private/var/db/launchd.db/com.apple.launchd.peruser.89: Permission denied
find: /private/var/db/launchd.db/com.apple.launchd.peruser.92: Permission denied
find: /private/var/db/launchd.db/com.apple.launchd.peruser.97: Permission denied
find: /private/var/db/locationd: Permission denied
find: /private/var/db/nsurlsessiond: Permission denied
find: /private/var/db/securityagent: Permission denied
find: /private/var/db/Spotlight: Permission denied
find: /private/var/db/sudo: Permission denied
find: /private/var/db/TokenCache: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.revisiond.temp: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/0/com.apple.Spotlight: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n000003000000r/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n000003800000t/C: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n000003800000t/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n000006w00001q/C: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n000006w00001q/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n0000084000021/C: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n0000084000021/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000b400002s/C: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000b400002s/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000bh00002w/C: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000bh00002w/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000c4000031/C: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000c4000031/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000s0000068/C: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000s0000068/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000s4000069/0/com.apple.dock.launchpad: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000s4000069/0/com.apple.notificationcenter: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000s4000069/0/com.apple.pluginkit: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000s4000069/C: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000s4000069/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000s800006_/C: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000s800006_/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000sm00006d/C: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000sm00006d/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000t800006k/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000th00006m/C: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000th00006m/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000tm00006n/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000vr00006y/C: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000vr00006y/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000xc00007b/C: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000xc00007b/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000y000007h/C: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000y000007h/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000y400007j/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000yc00007l/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000z000007r/0/com.apple.notificationcenter: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000z000007r/0/com.apple.pluginkit: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000z000007r/C: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_n00000z000007r/T: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_ngzzzzzvzzzzzy/C: Permission denied
find: /private/var/folders/zz/zyxvpxvq6csfxvn_ngzzzzzvzzzzzy/T: Permission denied
find: /private/var/jabberd: Permission denied
find: /private/var/lib/postfix: Permission denied
find: /private/var/log/com.apple.revisiond: Permission denied
find: /private/var/root: Permission denied
find: /private/var/run/mds: Permission denied
find: /private/var/spool/cups: Permission denied
find: /private/var/spool/fax: Permission denied
find: /private/var/spool/mqueue: Permission denied
find: /private/var/spool/postfix/active: Permission denied
find: /private/var/spool/postfix/bounce: Permission denied
find: /private/var/spool/postfix/corrupt: Permission denied
find: /private/var/spool/postfix/defer: Permission denied
find: /private/var/spool/postfix/deferred: Permission denied
find: /private/var/spool/postfix/flush: Permission denied
find: /private/var/spool/postfix/hold: Permission denied
find: /private/var/spool/postfix/incoming: Permission denied
find: /private/var/spool/postfix/maildrop: Permission denied
find: /private/var/spool/postfix/private: Permission denied
find: /private/var/spool/postfix/public: Permission denied
find: /private/var/spool/postfix/saved: Permission denied
find: /private/var/spool/postfix/trace: Permission denied
find: /System/Library/Caches/com.apple.coresymbolicationd: Permission denied
find: /System/Library/DirectoryServices/DefaultLocalDB/Default: Permission denied
find: /System/Library/User Template: Permission denied
find: /Users/Guest/.Trash: Permission denied
find: /Users/Guest/Desktop: Permission denied
find: /Users/Guest/Documents: Permission denied
find: /Users/Guest/Downloads: Permission denied
find: /Users/Guest/Library: Permission denied
find: /Users/Guest/Movies: Permission denied
find: /Users/Guest/Music: Permission denied
find: /Users/Guest/Pictures: Permission denied
find: /Users/Guest/Public/Drop Box: Permission denied
/Users/sgmacbookpro/Library/Logs/Homebrew/ideviceinstaller
/usr/local/bin/ideviceinstaller
/usr/local/Cellar/ideviceinstaller
/usr/local/Cellar/ideviceinstaller/HEAD/bin/ideviceinstaller
/usr/local/Library/LinkedKegs/ideviceinstaller
/usr/local/opt/ideviceinstaller
find: /usr/sbin/authserver: Permission denied
find: /Volumes/MobileBackups/Backups.backupdb/SGMacBookPRO’s MacBook Pro/2016-08-18-234845/MacOSX/.DocumentRevisions-V100: Permission denied
find: /Volumes/MobileBackups/Backups.backupdb/SGMacBookPRO’s MacBook Pro/2016-08-18-234845/MacOSX/.Trashes: Permission denied

Before run, could you possibly restart the IDE? Give a try.

Restart the IDE? Do you mean close & reopen the Eclipse?
If so same input.

  • Running via terminal/GUI: OK
  • Running via code: Facing issue
    In this case I just think the issue came from ideviceinstaller path. Somehow the IDE which perform the code didn’t has the right path value.

Sorry buddy. I have no idea anymore…

Some good info here on setting environment variables in Eclipse:

Hi TuHuynh,

This steps help me to solve the problem. I was really stuck for the problem from last couple of days. Had tried all the options of uninstalling/installing, upgrading/downgrading the appium, ideviceinstaller. But nothing was working. Thanks much again.

Wow. Happy when hearing that man!

Hi Lalit_garg,

You r using eclipse???