How to setup Appium with the andrioid/ios simulators on Mac

In today’s fast-moving world of mobile app development, ensuring your app runs smoothly across different devices is more important than ever. Appium, a powerful open-source automation framework, makes this easier by allowing developers and testers to automate applications on both Android and iOS using a single codebase. Unlike platform-specific testing tools, Appium supports multiple programming languages like Java, Python, and JavaScript, offering flexibility and efficiency.

While setting up Appium with Android and iOS simulators may seem complex at first, the right approach makes it much simpler. This guide will walk you through the entire process – installing dependencies, configuring emulators and simulators, and getting everything ready to automate mobile or web applications seamlessly.

Before diving into the installation, make sure you have the following:

  • node installed ( if it’s not installed, run brew install node on mac)
  • npm installed ( if it’s not installed, run brew install npm on mac)
  • Java installed

With that out of the way, let’s start with the setup. We will look at the setup of both iOS and Android simulators with Appium.

Let’s look at both of them one by one.

brew install carthage
npm install -g appium
appium -v
appium -v
appium driver install xcuitest
appium driver install xcuitest

Now, install the Xcode from the App Store: Link

  • Xcode includes an iOS Simulator, which is necessary to run tests without a physical device.
  • Appium relies on the simulator to launch Safari or test mobile apps.

After the Xcode is downloaded, please ensure to install the iOS simulator during the installation process.

Appium Doctor is a tool that helps verify if your Appium setup is correct and identifies any missing dependencies.

npm install -g appium-doctor

So, if we want to see whether the iOS setup is correctly done or not, then we can run the below command –

appium-doctor --ios
appium-doctor --ios

We can see which devices are available for running our Appium tests using the below command

xcrun simctl list devices
xcrun simctl list devices

If you run into an error with the command above, try running the command below and then try again

xcode-select --install

Run the appium command to start the appium server

Run appium command

As you can see, the Appium server has started on port 4723. We will use the “http://127.0.0.1:4723/” URL in our test case to run the first test with Appium.

As of now, the latest iPhone released by Apple is the iPhone 16. So, we’ll run the iPhone 16 simulator using Xcode.

  • Select “simulator” from the “Open Developer Tools” option
  • Next, choose the device you want to simulate, as shown in the video below.

That’s it! We’ve successfully set up the iOS simulator with Appium on our Mac.

npm install -g appium
appium -v
appium -v
appium driver install uiautomator2
appium driver install uiautomator2

Download and install the Android Studio – Download link

Run the below command to determine whether your Mac system uses ‘/bin/zsh‘ or ‘/bin/bash

 echo $SHELL

If the output is ‘/bin/zsh

Then run ‘vim ~/.zshrc

and if the echo $SHELL was ‘/bin/bash‘,

Then run the ‘vim ~/.bashrc

vim command will open the file in editor mode

Scroll to the bottom of the file using the arrow keys and paste the following lines:

export ANDROID_HOME=$HOME/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

Save the file and exit

Run ‘source ~/.zshrc‘ or ‘source ~/.bash_profile‘ (depending upon the result of the shell command) to reload the configuration.

This should set the ANDROID_HOME environment variable.

Appium Doctor is a tool that helps verify if your Appium setup is correct and identifies any missing dependencies.

npm install -g appium-doctor

So, if we want to see whether the Android setup is correctly done or not, then we can run the below command –

appium-doctor --android
appium-doctor --android
  • Open ‘Android Studio
  • Click on More Actions > Virtual Device Manager
  • Click on the + icon and add the device of your choice
  • Start the simulator by clicking on the run icon.

Run the appium command to start the appium server

Run appium command

As you can see, the Appium server has started on port 4723. We will use the “http://127.0.0.1:4723/” URL in our test case to run the first test with Appium.

This is it for this article. We hope that you liked the article. If you have any doubts or concerns, please write to us in the comments or mail us at admin@codekru.com.

Liked the article? Share this on

Leave a Comment

Your email address will not be published. Required fields are marked *