Using AppiumDriverLocalService to run tests on IOS failed

Hi all,

I’m working with Appium for the past few months and everything worked really good.

My next goal is to run Appium from the command line, so i was following this tutorial : Start and Stop Appium Server Programmatically
the service runs and works good.

mAppiumService = AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
		     .usingDriverExecutable(new File(appiumNodeFile))
		     .withAppiumJS(new File(appiumJSFile))
		     .withIPAddress(mAppiumServerAddress).usingPort(mAppiumServerPort));

where appiumNodeFile = /applications/Appium.app/Contents/Resources/node/bin/node
appiumJSFile = /applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js
and mAppiumService is an AppiumDriverLocalService object

I also have this method which runs @beforeSuite

public void startAppiumServer(String os){
	if(mAppiumService == null)
		launchAppiumServer(os);
	
	if(!mAppiumService.isRunning()){
		System.out.println(TAG + " Starting Appium Server....");
		mAppiumService.start();
		isServerRunning = true;
		
	}
	else{
		System.out.println(TAG + "Appium Server Is Already Running...");
	}
}

I set DesireCapabilities

/**
	 * set Appium Server settings
	 */
	private void setDesireCapabilities (){
		mCapabilities = new DesiredCapabilities();
		mCapabilities.setCapability(CapabilityType.PLATFORM, mPlatform);
		mCapabilities.setCapability(MobileCapabilityType.APP, mFullAppPath); //new File("src",mFullAppPath).getAbsolutePAth());
		mCapabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, mServerTimeOut);
		mCapabilities.setCapability(MobileCapabilityType.DEVICE_NAME,mDevice);
		if(mDeviceUDID != null && !mDeviceUDID.isEmpty())
			mCapabilities.setCapability(MobileCapabilityType.UDID,mDeviceUDID);
	}

and finally calling

mAppiumDriver = new IOSDriver(mAppiumService.getUrl(), mCapabilities);

I did installed ideviceinstaller using brew, it worked perfectly before,
However when running the test I get the following error(I marked relevant lines)

> path: /Users/nirberman/automation/SimgoApp/SimgoAppUtilities/files/Simgo.ipa
> Appium Manager Starting Appium Server....
> e[36minfoe[39m: Welcome to Appium v1.4.13 (REV c75d8adcb66a75818a542fe1891a34260c21f76a)
> e[36minfoe[39m: Appium REST http interface listener started on 127.0.0.1:4723
> e[36minfoe[39m: [debug] Non-default server args: {"address":"127.0.0.1"}
> e[36minfoe[39m: Console LogLevel: debug
> e[36minfoe[39m: e[37m-->e[39m e[37mGETe[39m e[37m/wd/hub/statuse[39m e[90m{}e[39m
> e[36minfoe[39m: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.4.13","revision":"c75d8adcb66a75818a542fe1891a34260c21f76a"}}}
> e[36minfoe[39m: e[37m<-- GET /wd/hub/status e[39me[32m200e[39me[90m 7.603 ms - 105e[39m e[90m{"status":0,"value":{"build":{"version":"1.4.13","revision":"c75d8adcb66a75818a542fe1891a34260c21f76a"}}}e[39m
> In LoginTest [login With Valid Values]
> e[36minfoe[39m: e[37m-->e[39m e[37mPOSTe[39m e[37m/wd/hub/sessione[39m e[90m{"desiredCapabilities":{"app":"/Users/nirberman/automation/SimgoApp/SimgoAppUtilities/files/Simgo.ipa","udid":"d9da6062f6556b899c475159a5439a60ffe9857b","platformName":"iOS","deviceName":"REAL","newCommandTimeout":"120","platform":"iOS"}}e[39m
> e[36minfoe[39m: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_65)
> e[36minfoe[39m: [debug] **The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : platform**
> e[36minfoe[39m: [debug] Using local .ipa from desired caps: /Users/nirberman/automation/SimgoApp/SimgoAppUtilities/files/Simgo.ipa
> e[36minfoe[39m: [debug] Copying local zip to tmp dir
> e[36minfoe[39m: [debug] /Users/nirberman/automation/SimgoApp/SimgoAppUtilities/files/Simgo.ipa copied to /var/folders/bj/mf99ylxd2k3g11msm3s4tw5c0000gn/T/116012-11266-1scu5f7/appium-app.zip
> e[36minfoe[39m: [debug] Unzipping /var/folders/bj/mf99ylxd2k3g11msm3s4tw5c0000gn/T/116012-11266-1scu5f7/appium-app.zip
> e[36minfoe[39m: [debug] Testing zip archive: /var/folders/bj/mf99ylxd2k3g11msm3s4tw5c0000gn/T/116012-11266-1scu5f7/appium-app.zip
> e[36minfoe[39m: [debug] Zip archive tested clean
> e[36minfoe[39m: [debug] Unzip successful
> e[36minfoe[39m: [debug] Using locally extracted app: /var/folders/bj/mf99ylxd2k3g11msm3s4tw5c0000gn/T/116012-11266-1scu5f7/Payload/Simgo.app
> e[36minfoe[39m: [debug] Creating new appium session 0c4fe3ca-d39b-42e2-85f6-86c64015ff4f
> e[36minfoe[39m: [debug] **Removing any remaining instruments sockets**
> e[36minfoe[39m: [debug] Cleaned up instruments socket /tmp/instruments_sock
> e[36minfoe[39m: [debug] Auto-detecting iOS udid...
> e[36minfoe[39m: [debug] Not auto-detecting udid, running on sim
> e[36minfoe[39m: [debug] **Could not parse plist file (as binary) at /var/folders/bj/mf99ylxd2k3g11msm3s4tw5c0000gn/T/116012-11266-1scu5f7/Payload/Simgo.app/en.lproj/Localizable.strings**
**> e[36minfoe[39m: Will try to parse the plist file as XML**
**> e[36minfoe[39m: [debug] Could not parse plist file (as XML) at /var/folders/bj/mf99ylxd2k3g11msm3s4tw5c0000gn/T/116012-11266-1scu5f7/Payload/Simgo.app/en.lproj/Localizable.strings**
**> e[33mwarne[39m: Could not parse app Localizable.strings assuming it doesn't exist**
> e[36minfoe[39m: [debug] Getting bundle ID from app
> e[36minfoe[39m: [debug] Could not parse plist file (as binary) at /var/folders/bj/mf99ylxd2k3g11msm3s4tw5c0000gn/T/116012-11266-1scu5f7/Payload/Simgo.app/Info.plist
> e[36minfoe[39m: Will try to parse the plist file as XML
> e[36minfoe[39m: [debug] Parsed app Info.plist (as XML)
> e[36minfoe[39m: [debug] Creating instruments
> e[36minfoe[39m: [debug] Preparing uiauto bootstrap
> e[36minfoe[39m: [debug] Dynamic bootstrap dir: /Users/nirberman/Library/Application Support/appium/bootstrap
> e[36minfoe[39m: [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"}
> e[36minfoe[39m: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!
> ...
> e[36minfoe[39m: [debug] Dynamic bootstrap path: /Users/nirberman/Library/Application Support/appium/bootstrap/bootstrap-3279913f037ed65f.js
> e[36minfoe[39m: [debug] Reusing dynamic bootstrap: /Users/nirberman/Library/Application Support/appium/bootstrap/bootstrap-3279913f037ed65f.js
> e[36minfoe[39m: [debug] **Attempting iOS device log capture via libimobiledevice idevicesyslog**
**> e[33mwarne[39m: Could not capture device log using libimobiledevice idevicesyslog. Libimobiledevice probably isn't installed**
> e[36minfoe[39m: [debug] Attempting iOS device log capture via deviceconsole
> e[36minfoe[39m: [debug] Creating iDevice object with udid d9da6062f6556b899c475159a5439a60ffe9857b
> e[36minfoe[39m: [debug] Couldn't find ideviceinstaller, trying built-in at /applications/Appium.app/Contents/Resources/node_modules/appium/build/libimobiledevice-macosx/ideviceinstaller
> e[31merrore[39m: **Could not initialize ideviceinstaller; make sure it is installed and works on your system**
**> e[36minfoe[39m: [debug] Cleaning up appium session**
**> e[31merrore[39m: Failed to start an Appium session, err was: Error: Could not initialize ideviceinstaller; make sure it is installed and works on your system**
> e[36minfoe[39m: [debug] Error: Could not initialize ideviceinstaller; **make sure it is installed and works on your system**
>     at [object Object].IOS.getIDeviceObj (/applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios/ios.js:909:13)
>     at [object Object].IOS.installToRealDevice (/applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios/ios.js:856:32)
>     at /applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:607:21
>     at /applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:246:17
>     at iterate (/applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:146:13)
>     at /applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:157:25
>     at /applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:248:21
>     at /applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:612:34
>     at [object Object].<anonymous> (/applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios/ios-crash-log.js:52:5)
>     at [object Object].<anonymous> (/applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios/ios-crash-log.js:27:5)
>     at f (/applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/node_modules/once/once.js:17:25)
>     at Glob.<anonymous> (/applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/glob.js:131:7)
>     at Glob.emit (events.js:107:17)
>     at Glob._finish (/applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/glob.js:168:8)
>     at done (/applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/glob.js:157:12)
>     at Glob._processReaddir2 (/applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/glob.js:351:12)
>     at /applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/glob.js:288:17
>     at RES (/applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/node_modules/inflight/inflight.js:23:14)
>     at f (/applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/node_modules/once/once.js:17:25)
>     at Glob._readdirEntries (/applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/glob.js:480:10)
>     at /applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/glob.js:457:12
>     at FSReqWrap.oncomplete (fs.js:95:15)
> e[36minfoe[39m: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not initialize ideviceinstaller; make sure it is installed and works on your system)","origValue":"Could not initialize ideviceinstaller; make sure it is installed and works on your system"},"sessionId":null}
> e[36minfoe[39m: e[37m<-- POST /wd/hub/session e[39me[31m500e[39me[90m 1471.652 ms - 300e[39m e[90me[39m
Utility.PlatformDriver.AppiumManagerMethod: getDriver A new session could not be created. (Original error: Could not initialize ideviceinstaller; make sure it is installed and works on your system) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.03 seconds
Build info: version: '2.48.2', revision: '41bccdd10cf2c0560f637404c2d96164b67d9d67'
System info: , os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.5', java.version: '1.8.0_65'
Driver info: io.appium.java_client.ios.IOSDriver

as you can refer Its already installed

Thanks alot

It’s a fairly common problem on this board. You don’t have ideviceinstaller on your $PATH. Here is a good guide to adding to your $PATH:

I also installed via brew, and the location on my machine is:

/usr/local/bin/ideviceinstaller

Same Error
if I type echo $PATH the output is :/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/ideviceinstaller

and the error remained

I think that the first entry, /usr/local/bin: should cover it. You wouldn’t need :/usr/local/bin/ideviceinstaller. Typically the $PATH is a list of directories to search, not a direct path to a binary.

Could it be possible that you are running the server from a different login/user (such as the root user) whose $PATH is different than the one you are checking?

Hi @wreed
It’s the same user, its really weird because when I run it with the GUI interface it works like a charm.

the node I use is /Applications/Appium.app/Contents/Resources/node/bin/node
I was trying several paths to the *.js files (main.js and appium.js)

same error. it just cant find the ideviceinstaller

That is very strange. Could you try a little debugging? For example, I believe you are coding in Java. Could you make some system calls from your code? Specifically, something like:

String[] cmd1 = { "/bin/sh", "-c", "which ideviceinstaller" };
String[] cmd2 = { "/bin/sh", "-c", "echo $PATH" };

Process p1 = Runtime.getRuntime.exec(cmd1);
Process p2 = Runtime.getRuntime.exec(cmd2);

log.info p1
log.info p2

This will give you some insight into what these values are at runtime & maybe we can figure out what is going on. If you don’t have a logger you could just use System.out.println or something.

Hi,
sorry for late respond,
I was off for few days :smiley: )

p1 returned an empty string, which means it has not found ideviceinstaller on runtime,
p2 returned /usr/bin:/bin:/usr/sbin:/sbin.

Tamir.

Ok, so we know that $PATH is different on a test run than it is in your normal shell environment. You need to get ‘/usr/local/bin/’ into that $PATH for this to work. You could try one of the techniques in the article I had posted above as a system call at the beginning of your tests (like an ‘export /usr/local/bin/’ type of call) which would be a short term fix. For longer term you may want to try and figure out why this happens. The most obvious would be that it’s run as a different user (which you’ve said is untrue) or perhaps running under a different shell? I’m not sure. You could try something like this:

String[] cmd1 = { "/bin/sh", "-c", "whoami" };
String[] cmd2 = { "/bin/sh", "-c", "echo $SHELL" };

Process p1 = Runtime.getRuntime.exec(cmd1);
Process p2 = Runtime.getRuntime.exec(cmd2);

log.info p1
log.info p2

And see what results you get.

Hi,

it’s weird , how are $PATH and bash_profile related to each other? when running the command: nano ~/.bash_profile
I see /usr/local/bin/ within the file.

I ran the commands you offered above,
p1 returned my username
p2 returned /bin/bash

should it be /bin/sh?

Thanks for you help, highly appreciated,
Tamir.

I believe that bash_profile is used for an interactive shell. Also, I think it’s fine to run in /bin/bash. I found a pretty good explanation of the different bash files (& more) here:

I wonder if you put /usr/local/bin into .bashrc if it would work properly for you?

Hi wreed,

I found the aforementioned file under /private/etc/bashrc but I’m not sure whether its the correct file or not. if so, I have no idea where I should insert this line.

Are you sure we are on the right path to solve this annoying issue?

Thanks,
Tamir.

No, I haven’t seen this exact thing. I’m volunteering this information, feel free to discard it.

.bashrc file goes into your home directory. I encourage you to read the link I sent you, and to do your own google search on .bashrc and what it’s for/how it’s used.

I’ve read it,

I feel we are getting further from the solution

its so weird , when I run Appium from the GUI interface it works like a charm. while running it from cmd gives an error.

Tamir.

I wish you’d give some input as to why you feel this way. I feel I’ve done my best to help you, but you may not want this to work.

Hi,
I have no complains to you my friend. I appreciate your concern.

as I mentioned, when running it from the GUI it works, it means that it runs in the background as expected.
correct me if Im wrong here.

Tamir.

I don’t actually know how the GUI does what it does (I’m not a developer). I took a look at the source this morning:

But I don’t know how it picks up paths exactly. I also looked at defaults for appium:

defaults read com.appium.Appium

But that doesn’t really show much. I also opened up ~/Library/Preferences/com.appium.Appium.plist in Xcode which looks about the same.

So I would say that using the GUI and running on command line are very different. I still think that getting .bashrc in your home directory configured with /usr/local/bin should fix this.

Ok,
Lets make it easier, since im not familiar with Mac Os that much.

I did not find /.bashrc under home directory but under /etc.
Found that post undertanding-bashrc-and-bash-profile

** my /.bashrc looks like that:**

   if [ -z "$PS1" ]; then
           return
        fi

        PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Tell the terminal about the working directory at each prompt.
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then
    update_terminal_cwd() {
        # Identify the directory using a "file:" scheme URL,
        # including the host name to disambiguate local vs.
        # remote connections. Percent-escape spaces.
	local SEARCH=' '
	local REPLACE='%20'
	local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
	printf '\e]7;%s\a' "$PWD_URL"
    }
    PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND"
fi
								    
# Paths
PATH=$PATH:${HOME}/bin:/sbin:/usr/sbin:/usr/local/bin
export PATH=$PATH:/usr/local/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig

my /.bash_profile looks like that:

   export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home
    export ANDROID_HOME=/usr/local/adt/sdk
    export ANDROID_HOME=/Users/nirberman/sdk
    export PATH=$PATH:/usr/local/bin

trying to run Appium from command line, I’ve got this output,

Appium Manager Starting Appium Server....
e[36minfoe[39m: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
e[36minfoe[39m: Appium REST http interface listener started on 127.0.0.1:4723
e[36minfoe[39m: [debug] Non-default server args: {"address":"127.0.0.1"}
e[36minfoe[39m: Console LogLevel: debug
e[36minfoe[39m: e[37m-->e[39m e[37mGETe[39m e[37m/wd/hub/statuse[39m e[90m{}e[39m
e[36minfoe[39m: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.4.16","revision":"ae6877eff263066b26328d457bd285c0cc62430d"}}}
e[36minfoe[39m: e[37m<-- GET /wd/hub/status e[39me[32m200e[39me[90m 7.564 ms - 105e[39m e[90m{"status":0,"value":{"build":{"version":"1.4.16","revision":"ae6877eff263066b26328d457bd285c0cc62430d"}}}e[39m
In LoginTest [login With Valid Values]
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
e[36minfoe[39m: e[37m-->e[39m e[37mPOSTe[39m e[37m/wd/hub/sessione[39m e[90m{"desiredCapabilities":{"app":"/Users/nirberman/automation/SimgoApp/SimgoAppUtilities/files/Simgo.ipa","udid":"d9da6062f6556b899c475159a5439a60ffe9857b","platformName":"iOS","deviceName":"REAL","newCommandTimeout":"120","platform":"iOS"}}e[39m
e[36minfoe[39m: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_65)
e[36minfoe[39m: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : platform
e[36minfoe[39m: [debug] Using local .ipa from desired caps: /Users/nirberman/automation/SimgoApp/SimgoAppUtilities/files/Simgo.ipa
e[36minfoe[39m: [debug] Copying local zip to tmp dir
e[36minfoe[39m: [debug] /Users/nirberman/automation/SimgoApp/SimgoAppUtilities/files/Simgo.ipa copied to /var/folders/bj/mf99ylxd2k3g11msm3s4tw5c0000gn/T/11614-76897-rxzayv/appium-app.zip
e[36minfoe[39m: [debug] Unzipping /var/folders/bj/mf99ylxd2k3g11msm3s4tw5c0000gn/T/11614-76897-rxzayv/appium-app.zip
e[36minfoe[39m: [debug] Testing zip archive: /var/folders/bj/mf99ylxd2k3g11msm3s4tw5c0000gn/T/11614-76897-rxzayv/appium-app.zip
e[36minfoe[39m: [debug] Zip archive tested clean
e[36minfoe[39m: [debug] Unzip successful
e[36minfoe[39m: [debug] Using locally extracted app: /var/folders/bj/mf99ylxd2k3g11msm3s4tw5c0000gn/T/11614-76897-rxzayv/Payload/Simgo.app
e[36minfoe[39m: [debug] Creating new appium session bb55ed1c-aa49-4f8e-ae44-b7d09f9da14b
e[36minfoe[39m: [debug] Removing any remaining instruments sockets
e[36minfoe[39m: [debug] Cleaned up instruments socket /tmp/instruments_sock
e[36minfoe[39m: [debug] Auto-detecting iOS udid...
e[36minfoe[39m: [debug] Not auto-detecting udid, running on sim
e[36minfoe[39m: [debug] Could not parse plist file (as binary) at /var/folders/bj/mf99ylxd2k3g11msm3s4tw5c0000gn/T/11614-76897-rxzayv/Payload/Simgo.app/en.lproj/Localizable.strings
e[36minfoe[39m: Will try to parse the plist file as XML
e[36minfoe[39m: [debug] Could not parse plist file (as XML) at /var/folders/bj/mf99ylxd2k3g11msm3s4tw5c0000gn/T/11614-76897-rxzayv/Payload/Simgo.app/en.lproj/Localizable.strings
e[33mwarne[39m: Could not parse app Localizable.strings assuming it doesn't exist
e[36minfoe[39m: [debug] Getting bundle ID from app
e[36minfoe[39m: [debug] Could not parse plist file (as binary) at /var/folders/bj/mf99ylxd2k3g11msm3s4tw5c0000gn/T/11614-76897-rxzayv/Payload/Simgo.app/Info.plist
e[36minfoe[39m: Will try to parse the plist file as XML
e[36minfoe[39m: [debug] Parsed app Info.plist (as XML)
e[36minfoe[39m: [debug] Creating instruments
e[36minfoe[39m: [debug] Preparing uiauto bootstrap
e[36minfoe[39m: [debug] Dynamic bootstrap dir: /Users/nirberman/Library/Application Support/appium/bootstrap
e[36minfoe[39m: [debug] Dynamic env: {"nodePath":"/Applications/Appium.app/Contents/Resources/node/bin/node","commandProxyClientPath":"/Users/nirberman/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"}
e[36minfoe[39m: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!
...
e[36minfoe[39m: [debug] Dynamic bootstrap path: /Users/nirberman/Library/Application Support/appium/bootstrap/bootstrap-f08a474a5b9b593b.js
e[36minfoe[39m: [debug] Reusing dynamic bootstrap: /Users/nirberman/Library/Application Support/appium/bootstrap/bootstrap-f08a474a5b9b593b.js
e[36minfoe[39m: [debug] Attempting iOS device log capture via libimobiledevice idevicesyslog
e[33mwarne[39m: Could not capture device log using libimobiledevice idevicesyslog. Libimobiledevice probably isn't installed
e[36minfoe[39m: [debug] Attempting iOS device log capture via deviceconsole
e[31merrore[39m: Log capture did not start in a reasonable amount of time
e[33mwarne[39m: Could not capture logs from device. Continuing without capturing logs.
e[36minfoe[39m: [debug] Creating iDevice object with udid d9da6062f6556b899c475159a5439a60ffe9857b
e[36minfoe[39m: [debug] Couldn't find ideviceinstaller, trying built-in at /Users/nirberman/node_modules/appium/build/libimobiledevice-macosx/ideviceinstaller
e[31merrore[39m: Could not initialize ideviceinstaller; make sure it is installed and works on your system
e[36minfoe[39m: [debug] Cleaning up appium session
e[31merrore[39m: Failed to start an Appium session, err was: Error: Could not initialize ideviceinstaller; make sure it is installed and works on your system
e[36minfoe[39m: [debug] Error: Could not initialize ideviceinstaller; make sure it is installed and works on your system
    at [object Object].IOS.getIDeviceObj (/Users/nirberman/node_modules/appium/lib/devices/ios/ios.js:909:13)
    at [object Object].IOS.installToRealDevice (/Users/nirberman/node_modules/appium/lib/devices/ios/ios.js:856:32)
    at /Users/nirberman/node_modules/appium/node_modules/async/lib/async.js:607:21
    at /Users/nirberman/node_modules/appium/node_modules/async/lib/async.js:246:17
    at iterate (/Users/nirberman/node_modules/appium/node_modules/async/lib/async.js:146:13)
    at /Users/nirberman/node_modules/appium/node_modules/async/lib/async.js:157:25
    at /Users/nirberman/node_modules/appium/node_modules/async/lib/async.js:248:21
    at /Users/nirberman/node_modules/appium/node_modules/async/lib/async.js:612:34
    at [object Object].<anonymous> (/Users/nirberman/node_modules/appium/lib/devices/ios/ios.js:1555:14)
    at /Users/nirberman/node_modules/appium/node_modules/underscore/underscore.js:890:21
    at [object Object]._onTimeout (/Users/nirberman/node_modules/appium/lib/devices/ios/ios-log.js:166:7)
    at Timer.listOnTimeout (timers.js:119:15)
e[36minfoe[39m: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not initialize ideviceinstaller; make sure it is installed and works on your system)","origValue":"Could not initialize ideviceinstaller; make sure it is installed and works on your system"},"sessionId":null}
e[36minfoe[39m: e[37m<-- POST /wd/hub/session e[39me[31m500e[39me[90m 10488.599 ms - 300e[39m e[90me[39m

please go over the output and let me know if you had noticed something.

Thanks!

That’s ok. You can create it yourself.

So I’m going to just going to give very basic instructions.

  1. open up a terminal window
  2. you should be in your home directory, type ‘pwd’ just to make sure
  3. type ‘ls -a’ and make sure there isn’t a ‘.bashrc’ file
  4. I’m assuming that there is not one since you said that, so type ‘vi .bashrc’ ← don’t forget the ‘.’ in front!
  5. type ‘a’ <-this puts you in append mode in vi
  6. cut the following and paste it into the vi session:
  1. hit the escape button to leave append mode
  2. Type ‘ZZ’ to write the file and quit

Now you should be able to to an ‘ls -a’ and see .bashrc in your home directory. Try running your appium commands and I think this will help. To debug, can you add the debugging code that we added before:

Then just reply back here. Fingers crossed!

Hi Wreed,

Thank you for fast respond,

  1. I created the file ‘.bashrc’ as you wrote.
  2. when debugging it, I still dont get the right path
    P1 prints nothing
    P2: /usr/bin:/bin:/usr/sbin:/sbin

when running the first command from the terminal I do get the right path. so it does exist.
“/usr/local/bin/ideviceinstaller”

I think its something with the shell.

I printed out all system environment parameters:

Key: APP_ICON_83481 Value: ../Resources/Eclipse.icns
Key: PATH Value: /usr/bin:/bin:/usr/sbin:/sbin
Key: SHELL Value: /bin/bash
Key: USER Value: nirberman
Key: TMPDIR Value: /var/folders/bj/mf99ylxd2k3g11msm3s4tw5c0000gn/T/
Key: JAVA_MAIN_CLASS_32429 Value: org.testng.remote.RemoteTestNG
Key: SSH_AUTH_SOCK Value: /private/tmp/com.apple.launchd.mrr1BsCZbO/Listeners
Key: XPC_FLAGS Value: 0x0
Key: APP_ICON_83467 Value: ../Resources/Eclipse.icns
Key: __CF_USER_TEXT_ENCODING Value: 0x1F5:0x0:0x0
Key: JAVA_STARTED_ON_FIRST_THREAD_83467 Value: 1
Key: Apple_PubSub_Socket_Render Value: /private/tmp/com.apple.launchd.67B0bWhI0h/Render
Key: LOGNAME Value: nirberman
Key: XPC_SERVICE_NAME Value: 0
Key: HOME Value: /Users/nirberman

as you can see the PATH does not contain '/usr/local/bin’
after running echo $PATH the output is:

PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/nirberman/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

(I dont know why it is replicated several times)

when calling ‘cat /etc/paths’ I get:

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

I agree with that!

Can I ask (and I’m sorry for not asking this earlier) if you are running this in an IDE? For some reason I’ve been thinking this is just a command line run, but your environment variables contain several Eclipse references…