Installing/Configuring Appium on MAC OS for Android

Appium setup made easy — Step by step process for Installing/ Configuring Appium & Appium Doctor on macOS for Android platform

— Vikas Kumar Garg, CoffeeBeans Consulting

Appium + appium doctor

What Is Appium

Appium is an open-source tool for automating native, mobile web, and hybrid applications on iOS mobile, Android mobile, and Windows Native apps that are written using the iOS, Android, or Windows SDKs.

Mobile web apps are web apps accessed using a mobile browser (Appium supports Safari on iOS and Chrome or the built-in ‘Browser’ app on Android). Hybrid apps have a wrapper around a “web-view” — a native control that enables interaction with web content.

Appium is a “cross-platform” tool: it allows you to write tests against multiple platforms (iOS, Android, Windows), using the same API. This enables code reuse between iOS, Android, and Windows test suites.

Appium + Appium Doctor

This article explains in detail how to install & Configure Appium on MAC with Android studio, related tools, and dependencies for Android.

This is a complete guide so you do not need to do anything separately for configuring Appium for Android on macOS. By using Appium-doctor we will check if our setup is done right. Different sections have been added to the article to explain different components.

Step-1: Install JAVA JDK

Java is required to run Appium desktop as well as Appium command line.

You should go to the below link and install JAVA JDK for MAC OS.

https://www.oracle.com/in/java/technologies/javase/jdk11-archive-downloads.html

Step-2: Set JAVA_HOME

Appium setup require JAVA_HOME to be set so that it can detect java related requirements while running Appium-Server/ Appium-Doctor.

Open a new terminal window and open .zprofile file by typing: vim .zprofile/ vi .zprofile now type below lines in the file:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.13.jdk/Contents/Home

Then, press esc key and enter :wq in the .zprofile to save the file

Open a new terminal and run the below command:

>JAVA_HOME/bin/java -version

You should see this -

Now check JAVA_HOME by typing >echo $JAVA_HOME. You should be able to see below mentioned screenshot :

Step-3: Install Android Studio / SDK tools:

For running Appium tests we need android SDK, Emulators and other related libraries. Android studio provides all these required libraries and emulators as well.

Go to https://developer.android.com/studio/ and download latest version of android studio.

Launch the .DMG file as installer and the Android Studio Setup Wizard guides you through the rest of the setup, which includes downloading Android SDK components that are required for the setup.

After Opening and selecting the default settings, Android Studio will start downloading the required libraries as shown below.

Android studio wizard

Step-4: Set ANDROID_HOME:

We should setup all below mentioned environment variables as they are needed by Appium server as well as by Appium-doctor while running the tests and inbuilt applications.

export ANDROID_HOME=/Users/<username>/Library/Android/sdk

export PATH=$PATH:$ANDROID_HOME/platform-tools

export PATH=$PATH:$ANDROID_HOME/tools

export PATH=$PATH:$ANDROID_HOME/tools/bin

export PATH=$PATH:$ANDROID_HOME/emulator

It looks like this in my machine as shown below in the screenshot

Now Type this command in the terminal : >android — You should see as shown in this screenshot:

You can check the ANDROID_HOME path by typing this command:

>echo $ANDROID_HOME

Step-5: Install NodeJS and NPM:

For installing Appium and other Appium related application via terminal we need nodejs and npm.

Check if nodejs is already installed : >node -v

Check if npm is already installed : >npm -v.

If it is installed you will see as shown below in the screenshot

If node and NPM are not installed then go to — https://nodejs.org/en/download/ & download mac installer as shown below.

Step-6: Install Appium using NPM via terminal

> npm install -g appium  #installs appium> npm install wd     # installs appium web clientIf there is permission issue - use sudo before above commands as shown in the screenshot below.

Step-7: Install Appium Desktop

Appium Desktop is used to configure Appium inspector and other dependencies which are not directly supported in Appium installed via npm. It provides a UI where we can set the dependencies.

Go to this link: https://github.com/appium/appium-desktop/releases/ and download dmg installer for mac.

Click and download .DMG file. For example, “ Appium-Server-GUI-mac-1.22.2.dmg“. Double click the .DMG file When the download finishes, and drag and drop the Appium into Applications as shown below.

You should be able to search Appium via spotlight search[command+shift key] in MAC OS as shown below:

Click on Appium Server GUI → Some people might see the popup as shown below:

Click ok on the screen and then open system preferences as shown below

Click on “Security and Privacy” as highlighted in above screenshot.

You should see as shown below in the screenshot.

Click on “Open Anyway” in above screenshot and you should see the screen as shown below:

Click on the button “Open” in above screenshot and Appium desktop server startup screen will be shown as displayed below:

Click on “Start Server v1.22.2” in above screenshot and appium server will start and following screen will appear:

Server will be stopped:

Click on Close Log button in the below screenshot and appium startup page will appear again.

Step-8: Install Appium-Doctor

Appium doctor is a command line utility which helps in identifying setup related issues. It helps us in identifying whether our appium setup is proper or not. Appium doctor can be install via terminal using following command(use sudo if you face permission issue)

> npm install -g appium-doctor

Step-9: Run Appium Doctor

Appium doctor helps us to make sure that our setup is working fine.

Run Appium doctor by following command: > appium-doctor android (For android setup verification). You will see the screen as shown below.

The above screen confirms that Appium is set up properly for Android.

Stay Tuned for the next post in Appium.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
CoffeeBeans_BrewingInnovations

CoffeeBeans_BrewingInnovations

CoffeeBeans empowers organizations to transform their business through the use of advanced technologies. Building data-driven solutions that drive innovation.