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.
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
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
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 email@example.com (latest stable version)
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.
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.