Install Appium v1.6 (from terminal – and setup for iOS)

Note: Copy/Pasting from appium’s official installation instructions page with necessary modifications/additions (for installing appium-doctor, carthage, grunt/grunt-cli and more importantly appium)

Note2: This answer is about installing appium v1.6 from terminal/console. Graphical App for v1.6 is not out yet because this version 1.6 is recently released but hopefully graphical app will also be available soon.

All of these commands are supposed to be run on terminal/console. Tested these steps on Mac. Comment below if it works for windows/ubuntu/etc. too

 

PART 1: Install rvm, ruby, homebrew, Node.js & NPM

(Skip to part 2 if your system already has homebrew, nodejs and npm installed)

Install the latest stable release of Ruby.

curl -sSL https://get.rvm.io | bash -s stable

Close terminal and open again. Otherwise rvm commands given below will not be recognised.

Now, install Ruby.

rvm install ruby

It will ask for some confirmations and password. Follow the instructions given in Terminal.

Make sure RVM is using the correct Ruby by default

rvm list
rvm --default use 2.1.1

If you have an old ruby/rvm, you can upgrade with

rvm get head
rvm autolibs homebrew
rvm install ruby (this will take longer if rvm starts compiling ruby for your system)

Check that it’s installed properly by printing the ruby version.

ruby --version

Update RubyGems and Bundler.

gem update --system
gem install --no-rdoc --no-ri bundler
gem update
gem cleanup

Check that RubyGems is >= 2.1.5

gem --version

Install appium_console gem.

gem uninstall -aIx appium_lib
gem uninstall -aIx appium_console
gem install --no-rdoc --no-ri appium_console

Install flaky gem.

gem uninstall -aIx flaky
gem install --no-rdoc --no-ri flaky

Install brew

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

Install nodejs using brew. Don’t use the big green install button on nodejs.org website or all npm commands will require sudo (and mac doesn’t allow “sudo npm …”)

brew update
brew upgrade node 

Above command will say something like “can’t update because not installed” if your system already doesn’t have node using brew. In that case don’t worry about it. Continue with install command below

brew install node

Node should be v4 or better.

node --version
npm --version

 

OPTIONAL PART FOR MOST PEOPLE

Install latest JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html

Install maven 3.1.1 or better. Old maven will not work. Install maven using following command

brew install maven

PART 2: Install appium, appium-doctor, authorize-ios, carthage, grunt

Now, install appium using npm

npm install -g appium@1.6.5 (latest stable version)

Install grunt.

npm install -g grunt

Change working directory to appium folder. Then run grunt version command. If you’re not in that folder, the grunt version will not display.

cd /usr/local/lib/node_modules/appium (appium path on MacOS when installed via npm -g as above)
grunt --version

It should print version of both grunt and grunt-cli like this

grunt-cli vX.Y.Z
grunt vA.B.C

For testing with iOS, you need authorize-ios. If you’re only testing Android, this can be skipped.

npm install -g authorize-ios

Run authorize-ios to permit appium to install/uninstall app under test to your target device

authorize-ios (this will ask you for system password. Enter it )

If you are testing for iOS version 9.3 and above (like the latest iOS 10.0), then you also need carthage using brew.

brew install carthage

Now, install appium-doctor which checks for dependencies for ios and android automation.

npm install -g appium-doctor

Run appium-doctor commands to see what dependencies are not installed/fixed.

appium-doctor (this will tell state of dependencies for andorid and ios both)
appium-doctor --ios (check only for ios dependencies )
appium-doctor --android (check only for android dependencies )

If there are any dependencies which are not fixed (red cross shows before dependecy description) then appium server will not work properly. So, you should fix the dependencies for the platform (ios/android) for which you are going to run your tests.

Fix ANDROID_HOME & JAVA_HOME errors reported by appium-doctor (for Mac)

If running appium-doctor reported android and java path errors, you can paste following text inside your “/Users/<your-username>/.bash_profile” file. If its not already present then create a new one.

#Hierarchy Viewer Variable 
export ANDROID_HVPROTO=ddm

export ANDROID_HOME=/Users/hasaanali/Library/Android/sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH

#Java JDK Path:
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=$JAVA_HOME/bin:$PATH

#source ~/.profile

CREATE APPIUM.TXT WITH CAPABILITIES

Before starting appium, create a new file “appium.txt” and save it on your Desktop. In this file we will write the server capabilities that we used to mention in the appium graphical app. Refer to this link of official documentation for Appium versions 1.6 to see all the capabilities you can choose from. Notice that in this link there some common capabilities and then there are also separate Android only and iOS only capabilities.

Below are the images of how your appium.txt file should look like.

Appium Capabilities for iOS.png
Sample capabilities for testing on iOS
appium-capabilities-for-android
Sample capabilities for testing on Android

FINALLY LAUNCH APPIUM SERVER

Open Terminal and run following commands

cd ~/Desktop (because here we have placed our appium.txt file) 
appium (run this from terminal whenever you need to launch appium server next time. But remember to do cd to path where you have put the appium.txt file)

Now appium server will be ready for accepting requests of client.

[Appium] Welcome to Appium v1.6.0
[Appium] Appium REST http interface listener started on 0.0.0.0:4723

Now run your tests if you already have them written or visit appium’s website to learn writing tests for android/ios.

STOPPING THE SERVER

Simply press CTRL+C in the same terminal window to stop the appium server.

HELPFUL LINKS (credits: appium.io)

Running tests on real iOS device (instead of simulator)

List of appium client libraries for different programming languages

Automating hybrid apps

Examples of tests in a variety of different languages

14 thoughts on “Install Appium v1.6 (from terminal – and setup for iOS)

    1. I believe you want to ask: “I have Appium server version 1.5 and I’m writing my tests in Python language using appium’s client library for python. How can I update my server to 1.6?”

      This rephrased question tells us that Appium server and appium client are two separate things.

      The appium server listens for requests from the client and performs the requested actions on the android or ios app under test. We launch this appium server either from graphical app or from terminal depending upon how we installed it. For version 1.6 of appium server, we don’t have graphical application yet so we have to install it by running a bunch of commands on terminal/cmd. This blog post explains how to do that.

      The appium client is actually our test code. We write these tests in Java, Python, C# etc. with the help of libraries provided on appium’s website. These libraries are called “Appium client libraries”. So now, what you need to do is just update your server version from 1.5 to 1.6 by following the same steps mentioned above. Your client (python with appium client library to communicate with server) should work fine and once you launch the server, your tests should run as before.

      Like

    1. Yes. Actually it will install v1.6 separately. You will launch this v1.6 from terminal by typing command “$ appium” and pressing Enter. Your oldler appium v1.5 can still be used from graphical application. You will not use graphical application to launch v1.6.

      Like

    1. Your npm commands (with or without -g option) will required sudo only if you’ve installed node from node’s website. To be able to run npm commands without sudo, your node should be installed using “brew install node” command. Then you should be able to run npm commands with or without -g option without using sudo.

      Like

  1. Hi,

    Thanks a lot for this post!

    Note that Carthage cannot be installed from npm but brew.

    Appium is the underlying engine when testing mobile application from Cerberus (http://cerberus-testing.org/). Your post is now included to the official documentation. But note we had to deal with additional packages and apply additional configuration to make Appium fully working.

    Please look at our documentation : https://cerberustesting.github.io/documentation_en.html#_appium.

    Regards,
    Cerberus Team

    Liked by 1 person

  2. Hi

    On running cmd $ appium i get below –
    Appium] Welcome to Appium v1.6.5
    [Appium] Appium REST http interface listener started on 0.0.0.0:4723
    [HTTP] –> GET / {}
    [debug] [HTTP] No route found. Setting content type to ‘text/plain’
    [HTTP] <– GET / 404 4 ms – 43

    Not sure what this is, can you help!

    Thanks a lot in advance!

    Like

    1. May be its a bug of v1.6.5. Try removing appium from terminal and installing v1.6.4. This is most stable latest version of appium.
      To remove appium, open terminal and enter:
      npm uninstall -g appium
      To install v1.6.4 enter:
      npm install -g appium@1.6.4

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s