Step 1: install java
Download and install Java JDK 8 and check whether Java is installed properly by typing java -version
Step 2: Setting up JAVA_HOME
Open the terminal and type the below
$ vim ~/.bash_profile and press [Enter]
Then to open edit or insert mode press I on the keyboard
export JAVA_HOME=$(usr/libexec/java/_home)
export PATH=$JAVA_HOME/bin=$PATH
now to save & exit, we need to exit from insert mode… To do that, press [esc] from keyboard and [Enter] : (colon)
now again to save & exit, enter wq following colon and hit [Enter]…..
Now type, source ~/.bash_profile (make changes permanently)
Now type, echo $JAVA_HOME — This will return java home variable.
Step 3: Install XCODE
install from app store.
Step 4: Install Homebrew & Command line tools
Homebrew – helps to install applications in mac through the terminal.
To install home-brew paste the below line at a Terminal prompt.
/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
now try, brew update or brew upgrade homebrew
and try, brew doctor
then if you get a message as ‘Your system is ready to brew’. Then we are good to go
then install of command line tool by typing,
xcode-select —install
Step 4: optional
Install android SDK
Step 5: Setting up ANDROID HOME
As we added java_home to an environment variable, we also need to add android_home to the environment variable list.
open $ vim ~/.bash_profile and press [Enter]
Step 6: Install Maven
Install Maven using brew from the terminal and set an environment variable.
brew install maven
Can also be installed from http://maven.apache.org/download.cgi
To set an environment variable,
vi .bash_profile
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
export M2_HOME=/Users/username/Downloads/apache-maven-3.5.0
export M2=/Users/username/Downloads/apache-maven-3.5.0/bin
export PATH=$M2_HOME/bin:$JAVA_HOME/bin:$PATH
esc +:wq to save the bash_profile file
Step 7: Install Appium
Install Appium desktop & through the command line or terminal using the below commands
brew install node
npm install -g appium
if you are getting below error while installing the appium ,then use sudo npm install -g appium --unsafe-perm=true --allow-root
[19:17:37] Error installing Chromedriver: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver’
[19:17:37] Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver’
[19:17:37] Downloading Chromedriver can be skipped by using the ‘–chromedriver-skip-install’ flag or setting the ‘APPIUM_SKIP_CHROMEDRIVER_INSTALL’ environment variable.
npm install wd
appium &
Step 8: XCUITest setup
XCUITest setup as below,
brew install libimobiledevice –HEAD # install from HEAD to get important updates
brew install ideviceinstaller # only works for ios 9. for ios 10, see below
brew install carthage
npm install -g ios-deploy
gem install xcpretty — for real devices,.. this will ask for write permission.
which appium
/path/where/installed/bin/appium
Given this installation location, /path/where/installed/bin/appium, WebDriverAgent will be found in /path/where/installed/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent. Open a terminal and go to that location, then run the following in order to set the project up:
1. mkdir -p Resources/WebDriverAgent.bundle
2. ./Scripts/bootstrap.sh -d
Open WebDriverAgent.xcodeproj in Xcode. For both the WebDriverAgentLib and WebDriverAgentRunner targets, select “Automatically manage signing” in the “General” tab, and then select your Development Team. This should also auto-select Signing Certificate. The outcome should look as shown below:
Finally, you can verify that everything works. Build the project:
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination ‘id=<id>’ test
If this was successful, the output should end with something like:
Test Suite ‘All tests’ started at 2017-01-23 15:49:12.585
Test Suite ‘WebDriverAgentRunner.xctest’ started at 2017-01-23 15:49:12.586
Test Suite ‘UITestingUITests’ started at 2017-01-23 15:49:12.587
Test Case ‘-[UITestingUITests testRunner]’ started.
t = 0.00s Start Test at 2017-01-23 15:49:12.588
t = 0.00s Set Up
* note: ios-deploy -c ———— to find udid of the device.
*
Other xcode commands
xcodebuild -showsdks
xcrun simctl list
Reference:
https://appiumpro.com/editions/122-installing-appium-20-and-the-driver-and-plugins-cli
https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md
https://www.headspin.io/blog/installing-appium-2-0-and-the-driver-and-plugins-cli
Make sure npm and node are updated