First time Appium configuration in Mac OS X

In this new post, I’ll try to go over all the steps needed to correctly setup Appium on a Mac. It depends on a few tools and libraries and requires some steps to set it up succesfully.

What is Appium?

From the official page:

“Appium is an open source test automation framework for use with native, hybrid and mobile web apps. It drives iOS, Android, and Windows apps using the WebDriver protocol.”

Basic Flow

basic_flow

Installation

First, I’ll show a diagram that shows all the dependencies to have a general view of the setup.

dependencies

Steps

  1. The first step on Mac OSX is install/update Xcode. This usually includes updating your operating system, restarts and fun stuff like that.
    1. Update your Mac OSX
    2. Search for Xcode in the app store
    3. You will need your apple account
    4. Start the download and go for a 🍺
    5. Then go for another one, the download is 4 Gb and then the installation, restarts, etc.
  2. Install Homebrew
    1. Open a Terminal
    2. Type brew --version
    3. If you get -bash: brew: command not found then run the following: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)
    4. If instead of that you get an error then your Homebrew is broken because the Yosemite update (if you have your Mac for a while). You have to type which brew
    5. If it returns a path, that means that IT IS installed. You need to type cd /usr/local/Library
    6. Then git pull origin master
    7. Then brew update && brew uninstall nodejs && brew install nodejs
    8. Finally to make sure is fixed brew --version
  3. Next step is to install Java
    1. Go to Java Downloads
    2. Accept Terms & Conditions
    3. Download the JDK for Mac OSX
    4. Install the JDK
  4. Then Android SDK (you can install only the SDK or the full Android Studio, we just need the SDK but if you install the Studio is fine too, the SDK comes included in the Studio)
    1. Go to Android_Downloads
    2. Download whatever you decided to download
  5. Get the paths for Android SDK y Java JDK
    1. First Java, we need to open the terminal again
    2. Type /usr/libexec/java_home -V
    3. Copy the path and paste it somewhere for later
    4. Then Android. Type find ~ -name "adb"
    5. Copy the path that returns (ignore the examples)
    6. Now we need to add those 2 paths to our Path
    7. Type nano ~/.bash_profile in the terminal
    8. Add the following lines
    9. export PATH=$PATH:path/a/android-sdk/platform-tools/:path/a/android-sd
      export JAVA_HOME="/path/a/java/home/"
      export ANDROID_HOME="/path/a/android/sdk"
    10. To save and exit hit the following keys
    11. ctrl + X
      then
      enter

    12. Finally type source ~/.bash_profile in the terminal for the changes to take effect
  6. Update Android SDK
    1. Type android in the terminal. This works because of the first line you just added in the .bash_profile file
    2. It will open a GUI, Select all the API versions you want to update, everything under “extras” and everything under “tools”
    3. Click on the “Install XX packages” button (where XX would be a number)
    4. In the next window select an Item from the list on the left then select Accept Terms
    5. Again is time for a 🍺
    6. Repeat all previous 5 steps a few times until there’s nothing to update.
  7. Install Node.js
    1. First, to check if it is already installed, open the terminal and type node --version
    2. Then which node
    3. If it returns -bash: node: command not found after the first command and nothing is returned after the second one, it is not installed. If the first command returns a version. We can skip the following steps.
    4. If it is not installed, to do so, type brew install node
  8. Finally is time to install Appium!
    1. Open the terminal and run the following commands one-by-one 1. npm install -g appium
    2. npm install wd
    3. code>npm install -g appium-doctor
    4. Run appium doctor to check out the installation: In the terminal type appium-doctor --ios
    5. Follow the suggested fixes if it finds errors
    6. Then appium-doctor --android
    7. Also follow the suggestions, if it finds errors
  9. Install RVM for Mac. For more info about RVM https://rvm.io/
    1. Type \curl -sSL https://get.rvm.io | bash in the terminal
    2. Wait for it to download
  10. Create a new project to start working
    1. Create a new folder wherever you want it to be.
    2. Create a new file called Gemfile within that folder using your favorite text editor.
    3. Add the following lines to that file and save.
      source 'http://rubygems.org'
      gem 'appium_lib'
      gem 'rspec'
      gem 'appium_console', '=1.0.4'
      gem 'os'
      gem 'allure-rspec'
    4. Save and open the terminal
    5. Type cd /path/to/the/project/folder
    6. Run the following from that folder rvm use --create 2.3.0 If you want to use ruby 2.3.0. You can change the version modifying this line to whatever you want to install.
    7. Then run gem install bundler
    8. Then bundle install
    9. Wait for everything to be installed

That’s it! You can start your proyect using Appium

2 thoughts on “First time Appium configuration in Mac OS X

Leave a Reply

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