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
Installation
First, I’ll show a diagram that shows all the dependencies to have a general view of the setup.
Steps
- The first step on Mac OSX is install/update Xcode. This usually includes updating your operating system, restarts and fun stuff like that.
- Update your Mac OSX
- Search for Xcode in the app store
- You will need your apple account
- Start the download and go for a ?
- Then go for another one, the download is 4 Gb and then the installation, restarts, etc.
- Install Homebrew
- Open a Terminal
- Type
brew --version
- 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)
- 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
- If it returns a path, that means that IT IS installed. You need to type
cd /usr/local/Library
- Then
git pull origin master
- Then
brew update && brew uninstall nodejs && brew install nodejs
- Finally to make sure is fixed
brew --version
- Next step is to install Java
- Go to Java Downloads
- Accept Terms & Conditions
- Download the JDK for Mac OSX
- Install the JDK
- 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)
- Go to Android_Downloads
- Download whatever you decided to download
- Get the paths for Android SDK y Java JDK
- First Java, we need to open the terminal again
- Type
/usr/libexec/java_home -V
- Copy the path and paste it somewhere for later
- Then Android. Type
find ~ -name "adb"
- Copy the path that returns (ignore the examples)
- Now we need to add those 2 paths to our Path
- Type
nano ~/.bash_profile
in the terminal - Add the following lines
- To save and exit hit the following keys
- Finally type
source ~/.bash_profile
in the terminal for the changes to take effect
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"
ctrl + X
then
enter - Update Android SDK
- Type
android
in the terminal. This works because of the first line you just added in the.bash_profile
file - It will open a GUI, Select all the API versions you want to update, everything under “extras” and everything under “tools”
- Click on the “Install XX packages” button (where XX would be a number)
- In the next window select an Item from the list on the left then select Accept Terms
- Again is time for a ?
- Repeat all previous 5 steps a few times until there’s nothing to update.
- Type
- Install Node.js
- First, to check if it is already installed, open the terminal and type
node --version
- Then
which node
- 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. - If it is not installed, to do so, type
brew install node
- First, to check if it is already installed, open the terminal and type
- Finally is time to install Appium!
- Open the terminal and run the following commands one-by-one 1.
npm install -g appium
npm install wd
- code>npm install -g appium-doctor
- Run appium doctor to check out the installation: In the terminal type
appium-doctor --ios
- Follow the suggested fixes if it finds errors
- Then
appium-doctor --android
- Also follow the suggestions, if it finds errors
- Open the terminal and run the following commands one-by-one 1.
- Install RVM for Mac. For more info about RVM https://rvm.io/
- Type
\curl -sSL https://get.rvm.io | bash
in the terminal - Wait for it to download
- Type
- Create a new project to start working
- Create a new folder wherever you want it to be.
- Create a new file called
Gemfile
within that folder using your favorite text editor. - 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'
- Save and open the terminal
- Type
cd /path/to/the/project/folder
- 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. - Then run
gem install bundler
- Then
bundle install
- 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”