Guide: Setting Up Appium on macOS for Java-Based Automated Testing on Android and iOS Devices

Guide: Setting Up Appium on macOS for Java-Based Automated Testing on Android and iOS Devices

5 April 2024 Stephan Petzl Leave a comment Tech-Help

Automated testing is a critical component of the modern development workflow. Appium is a popular open-source tool used for automating mobile application testing on both Android and iOS platforms. This guide will walk you through the process of setting up Appium on a macOS environment to run automated tests from Java classes on Android and iOS devices.


  • macOS operating system
  • Java Development Kit (Preferably Java 6)
  • Android SDK (for Android devices)
  • XCode (for iOS devices)
  • Maven (for project management and build automation)

Installation Steps

1. Install Java

Java 6 is a requirement for Appium. You can download it from Apple’s support page:

2. Update Bash Profile

Add the following paths to your bash profile:

export PATH=$HOME/local/bin:$PATH
export ANDROID_HOME=/path_to_your_android_sdk
export PATH="/path_to_your_android_sdk/platform-tools":$PATH
export PATH="/path_to_your_android_sdk/tools":$PATH
export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)
export PATH="/path_to_your_maven_bin":$PATH

3. Install Node.js and npm

Node.js is required to install Appium’s command-line tools. The following commands will install Node.js and npm without the need for sudo:

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl | tar xz --strip-components=1
./configure --prefix=~/local
make install

4. Install npm

curl | sh

5. Install Grunt CLI and Appium

npm install -g grunt-cli
npm install -g appium

6. Install WebDriverAgent dependencies

npm install wd

7. Starting the Appium Server

appium &

Running Your First Test

1. Navigate to Your Java Project

cd /path_to_your_java_project

2. Attach Your Android Device

Make sure your device is connected to your Mac via USB.

3. Launch the Appium Test

Execute the following command to start your Appium test:

mvn -Dtest=package_name.class_name test

Replace package_name with your actual Java package name and class_name with the name of the Java class containing your tests.


If you encounter errors related to directory permissions during the installation process, you may need to adjust the permissions using the chmod command:

chmod 777 /path_to_problematic_directory

After adjusting permissions, rerun the installation steps as needed.

This guide should help streamline your Appium setup process on macOS. If you require further assistance, you may seek help from the community or professional support services.

Like this article? there’s more where that came from!