Pre-requisites for Mobile Site AutomationSetup and Configure Appium on Mac operating system for iOS devices

Setup and Configure Appium on Mac Operating System for iOS Devices

Install and configure Appium, Xcode, WebDriverAgent, and supporting tools on macOS to automate iOS device and simulator testing.

Prerequisites

  • macOS Machine: A macOS machine where the Appium server will be running. The supported Appium version is 2.x. To set up the Appium server, refer to the Setup and Configure Appium on Mac Operating System article.
  • XCUITest Driver: 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.
  • Network Access: Your Python development machine must have network access to the macOS machine.

Install Homebrew, Carthage, and Node.js

  1. Install Homebrew — a package management system that makes it easier to install software on macOS machines. To install Homebrew, visit the Homebrew website and follow the instructions.
  2. Install Carthage — a dependency manager for iOS projects. Open the Terminal window and run the following command:
    brew install carthage
    
  3. Install Node.js and npm. Node.js allows developers to use JavaScript on the server side. Run the following command:
    brew install node
    

Install Java

  1. Download the JDK from the Oracle website.
  2. Run the downloaded installer and follow the on-screen instructions.
  3. Run the following command in the Terminal to locate the JDK installation path:
    /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.
  4. Open your .bash_profile file in an editor and add the following two lines:
    export JAVA_HOME="copied-path-to-JDK-directory"
    export PATH=$JAVA_HOME/bin:$PATH
    
  5. Save the changes.
  6. Restart the Terminal to apply the new .bash_profile settings.

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

  1. Download Xcode. Run the installer and follow the on-screen instructions.
  2. To install the Xcode command-line tools, run the following command in the Terminal:
    xcode-select --install
    

Install WebDriverAgent

WebDriverAgent is a WebDriver implementation for iOS. It is used to control iOS devices and apps remotely. If you have installed Appium via Node.js, you can find WebDriverAgent in the following directory:

/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent

Perform the following to install WebDriverAgent:

  1. In the Terminal window, navigate to the directory specified above and run the following commands:
    mkdir -p Resources/WebDriverAgent.bundle
    ./Scripts/bootstrap.sh -d
    
  2. Open the WebDriverAgent.xcodeproj project in Xcode. You can find the project in the directory specified above.