Appium for Mac Environment Preparation

I wrote an article on Appium for windows before , because it was a T400 in 2009, and it crashed three times when starting the Android emulator, so the company should apply for a Macbook air. The 15-inch Macbook Pro is too heavy, and only a Mac can Get the most out of Appium, supporting both Android and iOS. Okay, enough nonsense, let's get started.

1. Climbing the wall
Because there may be problems with the wall in the subsequent installation process, the problem of climbing the wall must be solved first.
For my convenience, the company provides agents.

2. java
guowenxie-macbookair:~ guowenxie$ java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

3. git
guowenxie-macbookair:~ guowenxie$ git --version
git version 1.8.5.2 (Apple Git-48)

4. ruby
guowenxie-macbookair:~ guowenxie$ ruby -v
ruby 2.0.0p451 (2014-02-24 revision 45167) [universal.x86_64-darwin13]

5. brew
guowenxie-macbookair:~ guowenxie$ brew -v
Homebrew 0.9.5

The installation of brew is mentioned here. brew is an indispensable package manager for Mac OS.
Execute the following command
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

6. Node
is easy to install node with brew
brew install node

7. above sea level
guowenxie-macbookair:~ guowenxie$ npm -v
2.0.0-alpha-5

8. Appium
can now start installing Appium


guowenxie-macbookair:~ guowenxie$ appium -v
1.2.0

9. wd
npm install wd


10. Not to mention Xcode and Android SDK

11. Check the environment
Appium provides a doctor, run appium-doctor 
guowenxie-macbookair:~ guowenxie$ appium-doctor 
Running iOS Checks
✔ Xcode is installed at /Applications/Xcode.app/Contents/Developer
✖ Xcode Command Line Tools are NOT installed: Error: Command failed: No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
Fix it? (y/n) y
Press any key to continue: 
✔ Xcode Command Line Tools are installed.
✔ DevToolsSecurity is enabled.
✔ The Authorization DB is set up properly.
✔ Node binary found at /usr/local/bin/node
✔ iOS Checks were successful.
Running Android Checks
✖ ANDROID_HOME is set but does not exist on the file system at "Users/guowenxie/Documents/adt-bundle_mac-x86_64-20140702/sdk"
Appium-Doctor detected problems. Please fix and rerun Appium-Doctor.

Here you can see that my Xcode Command Line Tools is not installed. This is convenient. When you enter Y when Fix it?, you can automatically guide the installation.
The other is that the environment variable of ANDROID_HOME is not configured, so we need to configure it.

12. The bash_profile file
Mac does not have this file by default, we build one by ourselves
touch .bash_profile

vi .bash_profile
打开bash_profile文件配置ANDROID_HOME和JAVA_HOME
export ANDROID_HOME="/Users/guowenxie/Documents/adt-bundle-mac-x86_64-20140702/sdk"
export JAVA_HOME=$(/usr/libexec/java_home)

source .bash_profile
好了,再次运行appium-doctor
guowenxie-macbookair:~ guowenxie$ appium-doctor 
Running iOS Checks
✔ Xcode is installed at /Applications/Xcode.app/Contents/Developer
✔ Xcode Command Line Tools are installed.
✔ DevToolsSecurity is enabled.
✔ The Authorization DB is set up properly.
✔ Node binary found at /usr/local/bin/node
✔ iOS Checks were successful.
Running Android Checks
✔ ANDROID_HOME is set to "/Users/guowenxie/Documents/adt-bundle-mac-x86_64-20140702/sdk"
✔ JAVA_HOME is set to "/usr/libexec/java_home."
✔ ADB exists at /Users/guowenxie/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb
✔ Android exists at /Users/guowenxie/Documents/adt-bundle-mac-x86_64-20140702/sdk/tools/android
✔ Emulator exists at /Users/guowenxie/Documents/adt-bundle-mac-x86_64-20140702/sdk/tools/emulator
✔ Android Checks were successful.
✔ All Checks were successful

到此,环境基本准备好了。

最后,如果不想通过命令行安装Appium,也可以安装dmg


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324521952&siteId=291194637