Category Page

In the last blog in this series we learned how to start the Appium server and launch app from the code. In this blog we will understand how to setup Appium on a Mac machine.

Pre-requisite

• Mac Book
• Xcode
• Simulator or real device
• Appium
• Eclipse
• Java

The first step is to install Xcode in the Mac Book. To do that, open app store and search for Xcode and click on the Get button to download Xcode.

download Xcode
Then click on the Install App option. This will install Xcode on your Mac machine. Now click on the Agree button if you agree with the terms and conditions and it will start installing components.

Once the Xcode is installed, you need to select “Create a new Xcode project” and you will be redirected to the template selection option.

template selection
You may select any of the templates or leave default settings as they are. Click on the next button to navigate to the next screen.

Now you will be asked to provide a product name and other product-related settings.

settings
Enter the required details and click on the next button. In the last seen of product settings, you will be asked to give the location in which to save your project.
Select the location anywhere as per your requirements and click on the create button.

create button
Once the project is loaded go to the Product menu option and click on the Run option.

Run option
Once you click on the run option, it will launch iOS simulator.

iOS simulator
Now right click on the simulator icon on the doc panel and select the keep in doc panel. In this way, you don’t need to start Xcode to launch the simulator. Thus you don’t need to open the Xcode project each time to launch iPhone simulator. If you want to see the list of simulators, got to the Window menu and select the Devices option. You will get a list of all the simulators available with this version of Xcode.

Installing JDK and setting the path

Download JDK for Mac OS and once the file is downloaded, double click on the file and install Java.

install Java
Now you need to set the Java installation path in your environment variable. Open a terminal and write “open.bash_profile”.

Open a terminal
If “.bash_profile” does not exist then execute the command “touch~/.bash_profile”. This will create the file. So when you execute the command, it opens the “.bash_profile” file.

execute the command
Copy the path to JDK home, write export JAVA_Home= and then save this file. Open command prompt and execute the java – version command. Open Appium.io and click on Download Appium button.

Appium button
Now download the latest .dmg file and once downloaded, double click on the .dmg file.

dmg file
It will open a new window where you need to drag and drop Appium into the application folder.

application folder
Search for Appium and double click on the Appium icon. This will launch the Appium server on your Mac machine.

Appium icon
To Launch Appium on a simulator click on the Start Server button.

Now click on the Start Inspector Session button in the Appium server.

Start Inspector Session
Once you select pCloudy as the cloud provider from the list you can click on Done.

cloud provider
Then you need to enter the Hostname, User name, API Key, Desired Capabilities and then click on Start Session.

Start Session
Your simulator is now connected.

17
Now you know how to setup Appium on Mac and in the previous blogs in this series we explained how to write the test script and start Appium server. In the next blog we will learn how to use Appium inspector to identify elements in an app.

Related Articles: