How to Install Appium on Mac OS in 3 Simple Steps

Automation testing is one of the essential tasks in Software testing. It allows automation testers to create a robust framework with an automation script, which can be run during functional or regression testing to save time as well as cost. There are variousĀ testing toolsĀ available for mobile app automation, but Appium is most widely used for test automation.

Here, we will learn how to install Appium on Mac OS in easy steps:

Setting up Mac OS for automation testing is a little difficult task if you are a new to Mac-based system. But if you are familiar with commands on the terminal, then it will be easy to complete the setup.

Install Java JDK latest version

First, download Java JDK from below path and install it (if you are using the same system for both automation and performance testing using JMeter then use JDK 8 or higher version of JDK, as they have more compatibilities).

https://www.oracle.com/technetwork/java/javase/downloads/index.html

Set Java Home Path using a terminal

Type below command on terminal:

open -e .bash_profile

It will open the bash profile in edit mode. Now you can edit Java_home, Android _home (for Android app automation, you need to install Android Studio from this linkĀ https://developer.android.com/studio/#mac-bundleĀ before Android home setup) with below commands:

Copy these commands and set your own username and JDK version and paste on bash profile:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home
export ANDROID_HOME=/Users/<username>/Library/Android/sdk
export PATH=$/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/
bin:$PATH
export PATH=ā€/Users/ <username> /Library/Android/sdk/platform-toolsā€:$PATH

then save from File > Save and close the bash profile text editor.

Now, your Java and Android home environment variable has been set.

How to Install Appium on Mac OS in 3 Simple Steps

Step 1: Install all the pre-requisites for Appium

  1. Install the latest Xcode Desktop version.
  2. Install Xcode command line (use Command: Xcode-select ā€“install)
  3. Install Homebrew with below command:

/usr/bin/ruby -e ā€œ$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)ā€

  1. brew installĀ npm
  2. npmĀ installĀ carthageĀ 
  3. npm install -g appium
  4. npm install appium-doctor -g
  5. Sudo gem install xcpretty
  6. brew install libimobiledevice ā€“HEAD
  7. npm install -g ios-deploy

Step 2: Download Appium Desktop and install it

Now, download the latest Appium desktop version from the below link and install it.

https://github.com/appium/appium-desktop/releases

And, here downloadĀ Appium-mac-1.15.1.dmgĀ and install.

Step 3: Setting up WebdriverAgent in XCode

This is a very important setup and needs to be done very carefully, otherwise, you will not be able to launch the Appium app.

(i) Open the terminal and go to WebDriverAgent folder within the Appium installation directory. It will be found at the below place:

Right click on Appium desktop > Contents /Resources/app/node_modules/Appium/node_modules/appium-xcuitest-driver/ WebDriverAgent

Now, run below two commands:

1) mkdir -p Resources/WebDriverAgent.bundle
2) ./Scripts/bootstrap.sh -d

(ii) Connect your iOS device with the system and open WebDriverAgent.xcodeproj in Xcode. For both the WebDriverAgentLib and WebDriverAgentRunner targets, select ā€œAutomatically manage signingā€ checkbox in the ā€œGeneralā€ tab, and then select your Development Team. This should also auto select Signing Certificate.

You need to provide Apple developer account credentials to select the team.

Xcode maybe fail to create a provisioning profile for the WebDriverAgentRunner, this needs manual change to the bundle id for the target. Go into the ā€œBuild Settingsā€ tab, and change the ā€œProduct Bundle Identifierā€ from com.facebook.WebDriverAgentRunner to something unique that Xcode will accept: like ā€“ com.facebooksss.WebDriverAgentRunner.

Similarly, setup WebDriverAgentLib and Integration App in Xcode. Then run (build) integration app. To run the Integration App, Apple id is required, and it should be trusted on a real iPhone device from:

Settings > General > Device Management.

Here click on the Apple id to trust it.

Now close Xcode (end tasks pop up appears), and quit Xcode then run below test command with udid within WebDriverAgent destination on terminal:

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination ā€˜id=<udid>ā€™ test

If everything is properly set, then you will get terminal like this after running above command:


Test Suite ā€˜All testsā€™ started at 2019-10-23 15:49:12.585
Test Suite ā€˜WebDriverAgentRunner.xctestā€™ started at 2019-10-23 15:49:12.586
Test Suite ā€˜UITestingUITestsā€™ started at 2019-10-23 15:49:12.587
Test Case ā€˜-[UITestingUITests testRunner]ā€™ started.
t = 0.00s Start Test at 2019-10-23 15:49:12.588
t = 0.00s Set Up

Get <udid> by running $ios-deploy -c (before running this command, make sure iPhone is attached with USB and USB debugging is ON)

Launch Appium on Mac OS X

Now, open the Appium app from ā€˜Applicationā€™ and start the Appium Server.

After providing the desired capabilities in Appium Inspector, you can start the session. You can save this desired capability for next time for quick access.

By using the aboveĀ steps, Click on ā€˜Start Sessionā€™ and this will start to install the app under test on the device and UI will be displayed in Appium Inspector, here you can find the locators and start writing automation test script.

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
wpDiscuz
0
0
Would love your thoughts, please comment.x
()
x
Exit mobile version