1. 爬墙
因为后续安装过程中可能会碰到墙的问题,所以首先得解决爬墙的问题。
我的方便,公司提供代理。
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
这边提下brew的安装,brew是mac os不可或缺的套件管理器
执行下面命令
ruby -e "$(curl -fssl https://raw.github.com/homebrew/homebrew/go/install)"
6. node
有了brew安装node就方便了
brew install node
7. npm
guowenxie-macbookair:~ guowenxie$ npm -v
2.0.0-alpha-5
8. appium
现在可以开始安装appium
guowenxie-macbookair:~ guowenxie$ appium -v
1.2.0
9. wd
npm install wd
10. xcode和android sdk
这个不说了
11. 检查环境
appium提供了一个doctor,运行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.
这里可以看到我xcode command line tools没有安装,这个方便,fix it 的时候输入y,就能自动导向安装了。
另一个是android_home的环境变量没配置好,那么我们要配置下。
12. bash_profile文件
mac 默认是没有这个文件的,我们自己建一个
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
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
最新内容请见作者的github页:http://qaseven.github.io/