Setup and Configure Appium on Mac Operating System for iOS Devices
The following instructions outline the process of setting up an Appium instance on a macOS machine and configuring it to manage iOS devices.
Prerequisites
- A macOS machine where the Appium server will be running. The supported Appium version is 2.x. To set up the Appium server, click here.
- The XCUITest driver must be installed on the Appium server. For more information, see the driver description in the Appium documentation: The XCUITest Driver for iOS.
- Your Python development machine must have network access to the macOS machine.
Install Homebrew, Carthage, and Node.js
- Install Homebrew (a package management system that makes it easier to install software on macOS machines).
- To install Homebrew, click here and follow the instructions.
- Install Carthage (a dependency manager). To do this, open the Terminal window and run the following command:
brew install carthage
- Node.js allows developers to use JavaScript on the server side. Install Node.js and npm. To do this, run the following command:
brew install node
Install Java
- Download the JDK from the Oracle website.
- Run the downloaded installer and follow the on-screen instructions.
- Run the following command in the Terminal:
/usr/libexec/java_home --v
This command displays the location of the JDK on your computer similar to the following path: /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home. Copy the path.
- Open your
.bash_profilefile in an editor and add the following two lines to it:
export JAVA_HOME="copied-path-to-JDK-directory"
export PATH=$JAVA_HOME/bin:$PATH
- Save the changes.
- Restart the Terminal to apply the new
.bash_profilesettings.
Install Appium
To install Appium with npm, run the following command in the Terminal window:
npm install -g appium
It is recommended that you install the Appium Doctor in addition to Appium. It will help you fix issues with Appium and iOS settings. To install the Appium Doctor, run the following command in Terminal:
npm install -g appium-doctor
Install Xcode and Xcode Command-Line Tools
- Download Xcode. Run the installer and follow the on-screen instructions.
- To install the Xcode command-line tools, run the following command in the Terminal:
xcode-select --install
Install WebDriverAgent
WebDriverAgent is a WebDriver version for iOS. It is used to control iOS devices and apps remotely. You can find it in the following directory:
If you have installed Appium via Node.js:
/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent
To install:
- In the Terminal window, go to the directory specified in the previous step and run the following commands:
mkdir -p Resources/WebDriverAgent.bundle
./Scripts/bootstrap.sh -d
- Open the WebDriverAgent.xcodeproj project in Xcode (you can find the project in one of the directories specified in the previous step).