Starting Appium server programmatically on MAC

@ildi, My scripts are executed by ant tool before calling the ant i’m calling the appium.command batch file

Appium.command content-

/usr/local/bin/appium

Ant.command content-

cd ‘dirname $0’ (to change directory to current directory )

open appium.command(To call the appium.command file in directory)

ant

1 Like

How To Create Bash File in iOS ?
Please Help.

Thanks,
Ajit.

@AjitJ http://www.maclife.com/article/columns/terminal_101_automate_terminal_bash_scripts

Hello Hassn,

Please look into this:

Samples-Mac-mini:~ Sampleit$ /bin/sh /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js --address 127.0.0.1 --chromedriver-port 9516 --bootstrap-port 4725 --no-reset --local-timezone
/Applications/Appium.app/Contents/Resources/node/bin/node: /Applications/Appium.app/Contents/Resources/node/bin/node: cannot execute binary file
Samples-Mac-mini:~ Sampleit$

@AjitJ
If you are typing the command in your terminal, you should remove the “/bin/sh” part. You only add it when you are executing from inside Java.

Coooooool…Its Working Fine.

Thanks a LOT…
:grinning:

Hello Hassan,

Please Look into This,

As I am trying to execute(Launhching) Appium Server from Jenkins Shell Command its showing Error as Below…

[31merrore[39m: Appium will not work if used or installed with sudo. Please rerun/install as a non-root user. If you had to install Appium using sudo npm install -g appium, the solution is to reinstall Node using a method (Homebrew, for example) that doesn’t require sudo to install global npm packages.
Build step ‘Execute shell’ marked build as failure
Finished: FAILURE

Please Help,
Thanks,
Ajit Jadhav.

@AjitJ
The error message is self explanatory. Please uninstall Appium and reinstall it again without the “sudo” command as Appium can’t work if it was installed with Sudo command on Mac OS environment.

but it works properly if executed from Terminal.

Thanks. Its working.

Hi Guys,

I am unable to starting iOS webkit debug proxy server and get iPhone information( UDID, Device Name and Device Version) from Terminal Using Java Code in mac machine. Is it possible to get the iOS device information from terminal using java code in mac machine. This is priority work for me. Please help me any one.

Thanks in advance.

HI @Hassan_Radi

How can I start Appium sever from command prompt using external appium package. I have GUI of 1.4.8 and I am referring 1.4.12 code.

If I used below command, then it is picking up 1.4.8
/Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js --address 127.0.0.1 --port 4723 --no-reset --show-ios-log --launch-timeout “120000”

Do you know which argument I should add for “External Appium Package”

Thanks
Sunny Sachdeva

@sunny_sachdeva

You need to change this line to refer to the location of the 1.4.12 package.

Hi Hasan,

I tried below command

/Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js --address 127.0.0.1 --chromedriver-port 9516 --bootstrap-port 4725 --no-reset --local-timezone

but Appium server still listens at port 4723

/Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js --address 127.0.0.1 --chromedriver-port 9516 --bootstrap-port 4725 --no-reset --local-timezone
info: Welcome to Appium v1.4.13 (REV c75d8adcb66a75818a542fe1891a34260c21f76a)
info:

Appium REST http interface listener started on 127.0.0.1:4723

info: [debug] Non-default server args: {“address”:“127.0.0.1”,“bootstrapPort”:4725,“noReset”:true,“localTimezone”:true,“chromeDriverPort”:9516}
info: Console LogLevel: debug

@Venkatesh

This doesn’t change the server port number, use this to change the server port number

–port 4725

Also it would be better if you don’t write any code at all and use my “Appium Support” library to take care of that: Home · Genium-Framework/Appium-Support Wiki · GitHub

1 Like

I get the below error when i use port

appium.js: error: Unrecognized arguments: —port 4725.

my bad i used — instead of – :(, works now thanks Hassan.

Hey guys,
So I have another Mac I try to work with to start an Appium session. While with the first Mac it works well the newer doesn’t allow me to initiate the Appium programmatically. Here’s the code I am using:
ssh.RunCommand("/usr/local/bin/forever start /Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js --address 0.0.0.0 --port 4723 --log-level debug --device-name \"iPhone 6\" --platform-name iOS --platform-version \"8.4\" --app \"/Applications/my.app\" --browser-name iOS -l --log /Library/Logs/Appium/current.log");

For some reason it tells me: “env: node: No such file or directory”
Now, I am guessing that there’s some problem running the “forever” file. But I am not sure what stops it from running properly…
Thanks!

Hello Friends,

Please try the code that I posted in my post http://aksahu.blogspot.in/2015/10/start-and-stop-appium-server.html

Hope it will help you!

Thanks,
Aswini Kumar

I am having an issue getting appium to run from the terminal:

Automation-MacBook-Pro:~ testingpractice$ '/Applications/Appium.app/Contents/Resources/node/bin/node'
> /Applications/Appium.app/Contents/Resources/node_modules/appium.js
SyntaxError: Invalid flags supplied to RegExp constructor 'Appium'
    at new RegExp (native)
    at repl:1:1
    at REPLServer.defaultEval (repl.js:132:27)
    at bound (domain.js:254:14)
    at REPLServer.runBound [as eval] (domain.js:267:12)
    at REPLServer.<anonymous> (repl.js:279:12)
    at REPLServer.emit (events.js:107:17)
    at REPLServer.Interface._onLine (readline.js:214:10)
    at REPLServer.Interface._line (readline.js:553:8)
    at REPLServer.Interface._ttyWrite (readline.js:830:14)
> /Applications/Appium.app/Contents/Resources/node_modules/appium.js --address 127.0.0.1 --port 4723 --command-timeout "7200" --debug-log-spacing --platform-version "9.2" --platform-name "iOS" --show-ios-log --default-device --native-instruments-lib
SyntaxError: Unexpected identifier
    at Object.exports.createScript (vm.js:44:10)
    at REPLServer.defaultEval (repl.js:117:23)
    at bound (domain.js:254:14)
    at REPLServer.runBound [as eval] (domain.js:267:12)
    at REPLServer.<anonymous> (repl.js:279:12)
    at REPLServer.emit (events.js:107:17)
    at REPLServer.Interface._onLine (readline.js:214:10)
    at REPLServer.Interface._line (readline.js:553:8)
    at REPLServer.Interface._ttyWrite (readline.js:830:14)
    at ReadStream.onkeypress (readline.js:109:10)

I can’t figure out what’s going wrong here. At the moment I am not trying to do this from within code. I am just manually trying to get the command to work in the terminal. Once I get the syntax of the command down I plan to execute it from my C# test via SSH.NET from a Windows PC.