How to start Appium server from the command line in a MAC machine?

I am automating native mobile app. So far, I have started the server from the Appium GUI by clicking the start button. Now I want to start the server from the command line.

I was able to do the same on a Windows machine by following these steps:

  • Run Node.js command prompt
  • Browse to the folder with the Appium folder
  • Use the node appium

I am blocked on how to run Node.js command prompt on Mac. Could you tell me how I can start the Appium server from the command line on a Mac.

+9
source share
9 answers

if you used npm install -g appium, then you can open it with the command

 appium //plus any server args you want ex: appium -p 4474 

Or you can still go to your node_modules folder and in appium and go from

 node . //plus any server args you want 

if you want to have additional server flags, all of them are available on their website with documentation.

+5
source
 /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 --command-timeout 7200 --session-override --debug-log-spacing --platform-version 9.0 --platform-name iOS --app /Users/chennareddy/u/apps/TestApp/build/release-iphonesimulator/Handstand/Handstand.app --show-ios-log --device-name iPhone-6s --native-instruments-lib --orientation Portrait 
+2
source

Open a terminal and enter the following command

 appium --address 127.0.0.1 --port 4723 

Press enter, then it will register at 127.0.0.1 and will listen on port 4723. You can expand this command by adding an application type, etc.

Hope this helps you

greetings

+2
source

To run appium on the MAC, all you have to do is enter type => appium & in the terminal application. For this command to work, you need to install appium in terminal mode. However, there are two ways to do this: one with HomeBrew and the other directly with Node.js. You can find the HomeBrew installation guide online. Follow these steps to install it directly using Node.js -

  • Go to https://nodejs.org/
  • Download and install the latest stable version of Node.js package on your mac
  • Now open the terminal application
  • Run the following command => npm install -g appium
  • This should install Appium on your system with global privileges. After installing appium, you can run the command => appium-doctor in the same terminal window to check if everything is installed correctly.
  • If everything is in green ticks, run => appium & to start the application server

Hope this helps.

+1
source

As the other answers indicate, if you installed the Appium terminal through the terminal, simply enter appium & in the terminal window to start the appium server. Here is all you need to know how to install appium through the terminal.
1. Install Homebrew .

 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

2. Give the following commands one by one to install appium

 brew install node # get node.js npm install -g appium # get appium npm install wd # get appium client appium & # start appium 

You can find a link to step by step help for appium download osx here.

+1
source
 String tellCommand = "tell application \"Terminal\" to do script \"/usr/bin/node_modules/appium/bin/appium.js"; String parameters = " -p "+port; parameters += " "+ (fullReset ? "--full-reset" : "--no-reset")+"\""; tellCommand += parameters; String[] command = { "osascript", "-e", tellCommand }; ProcessBuilder pBuilder = new ProcessBuilder(command); pBuilder.start(); 
0
source

Try starting the appium software server for mac os, including the automation of the webkit debugging proxy, which is necessary for debugging.

  //customize the below in start server method //Webkit Proxy command CommandLine iOSProxyCommand = new CommandLine("ios_webkit_debug_proxy"); iOSProxyCommand.addArgument("-c"); iOSProxyCommand.addArgument(udid+":27753");//provide your udid of the device iOSProxyCommand.addArgument("-F");//to disable console output in eclipse DefaultExecuteResultHandler iOSProxyresultHandler = new DefaultExecuteResultHandler(); DefaultExecutor iOSProxyexecutor = new DefaultExecutor(); iOSProxyexecutor.setExitValue(1); try { iOSProxyexecutor.execute(iOSProxyCommand, iOSProxyresultHandler); iOSProxyCommand.toString())); Thread.sleep(5000); System.out.println("iOS Proxy started."); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } CommandLine command = new CommandLine( "/Applications/Appium.app/Contents/Resources/node/bin/node"); command.addArgument( "/Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js", false); command.addArgument("--address", false); command.addArgument("127.0.0.1"); command.addArgument("--port", false); command.addArgument("4723"); command.addArgument("--full-reset", false); command.addArgument("--log-level", false);//to disable console output in eclipse command.addArgument("error"); command.addArgument("--log", false); Timestamp currentTimestamp = new java.sql.Timestamp(Calendar.getInstance().getTime().getTime()); command.addArgument("/Users/sethupandi/appium"+currentTimestamp+".log"); DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); DefaultExecutor executor = new DefaultExecutor(); executor.setExitValue(1); try { executor.execute(command, resultHandler); Thread.sleep(5000); System.out.println("Appium server started."); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } //customize the below in stop appium server- //kill appium node after end of your execution String[] command = { "/usr/bin/killall", "-9", "node" }; try { Runtime.getRuntime().exec(command); System.out.println("Appium server stopped."); } catch (IOException e) { e.printStackTrace(); } //Kill webkit proxy for iOS String[] commandProxy = { "/usr/bin/killall", "-9", "ios_webkit_debug_proxy" }; try { Runtime.getRuntime().exec(commandProxy); System.out.println("iOS Webkit proxy stopped"); } catch (IOException e) { e.printStackTrace(); } 
0
source

For everyone who reads this, who uses npm (node ​​/ js / typescript), I created a module called appium-controller that starts and stops appium in the background programmatically (Mac or Windows). It has the ability to transmit on a specific port either through a node call to a method, or through cli.

0
source
  • Install the latest version of Android Studio
  • Install the Java SDK from: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
  • Install Homebrew using
  • Install ruby: / usr / bin / ruby ​​-e "$ (curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )"
  • Download the installer: https://nodejs.org/en/download/ and run
  • in terminal:
    • brew update
    • brew installation node (if the post-installation was refused permission, run "sudo chown -R $ (whoami): admin / usr / local / lib / node_modules /")
    • npm install -g npm
  • Update system settings: open bash_profile in terminal:
  • nano ~ / .bash_profile
    • insert the following:
  • export ANDROID_HOME = / users / jenkinss / library / Android / sdk export PATH = $ ANDROID_HOME / platform tools: $ PATH export PATH = $ ANDROID_HOME / tools: $ PATH export JAVA_HOME = $ (/ usr / libexec / java_home)
    • Save and exit
  • install the Appium UI tool form here: https://bitbucket.org/appium/appium.app/downloads/appium-1.5.3.dmg
  • install Appium in the Terminal from the command line:
  • npm install -g appium@1.7.1 npm install wd
  • Now fix the beta version of Appium with:
  • cd / usr / local / lib / node_modules / appium / node_modules / appium-xcuitest -d river / WebDriverAgent
  • cook set carthage
  • Npm i -g web package
  • . /Scripts/bootstrap.sh -d
  • npm install appium -d octor -g
  • run appium -d octor - android and fix JAVA_PATH and ANDROID_PATH problems
  • run 'appium -d octor β€”ios
  • install xcode command line tools if not installed: xcode-select β€”install
  • brew install libimobiledevice β€”HEAD
  • npm install -g ios -d eploy
  • install the appium-xcuitest driver: npm i appium-xcuitest -d river
  • Open WebDriverAgent.xcodeproj from / usr / local / lib / node_modules / appium / node_modules / appium-xcuitest -d river / WebDriverAgent and sign the lib and runner files
  • brew install ios-webkit -d ebug-proxy
  • got to: / usr / local / lib / node_modules / appium / node_modules / appium-xcuitest -d river / node_modules / appium-xcode /
  • git clone https://github.com/facebook/WebDriverAgent
  • cd WebDriverAgent /
  • launch. /scripts/bootstrap.sh
  • open WebDriverAgent.xcodeproj and sign lib and runner
  • git clone https://github.com/google/ios-webkit-debug-proxy.git
  • cd ios-webkit -d ebug-proxy
  • . /autogen.sh
  • make
  • sudo make install (installs in / usr / local / bin / ios_webkit_debug_proxy)
-1
source

Source: https://habr.com/ru/post/974799/


All Articles