Appium环境配置-Mac

1、下载appium之前命令行检查

1
2
3
4
5
6
7
8
9
10
$ java -version
java version "1.8.0_71"
Java(TM) SE Runtime Environment (build 1.8.0_71-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.71-b15, mixed mode)<br>
$ brew -v
Homebrew 0.9.9 (git revision 1158; last commit 2016-07-20)
Homebrew/homebrew-core (git revision 666b; last commit 2016-07-20)
 
$ node -v
v6.3.0

如果brew和node未安装: 

a.安装brew命令

1
$ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
b.安装node命令
1
$brew install node

2、安装Appium

a.给予local文件可读可写可执行权限

1
$sudo chmod -R 777 /usr/local

b.非root权限下安装Appium

1
$npm install -g appium

c.安装Appium Client

1
2
3
$git clone https://github.com/appium/python-client.git
$cd python-client/
$sudo python setup.py install

d.安装appium-doctor(已经安装的用户可忽略)

1
2
3
$ appium-doctor
-bash: appium-doctor: command not found
superFangfang:python-client macbook$ npm install appium-doctor -g

e.安装appium.dmg客户端

下载链接地址:https://bitbucket.org/appium/appium.app/downloads/

3.检查Appium成功安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$ appium-doctor
info AppiumDoctor ### Diagnostic starting ###
info AppiumDoctor  ✔ Xcode is installed at: /Applications/Xcode.app/Contents/Developer
WARN AppiumDoctor  ✖ Xcode Command Line Tools are NOT installed!
info AppiumDoctor  ✔ DevToolsSecurity is enabled.
info AppiumDoctor  ✔ The Authorization DB is set up properly.
info AppiumDoctor  ✔ The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor  ✔ HOME is set to: /Users/macbook
WARN AppiumDoctor  ✖ ANDROID_HOME is NOT set!
WARN AppiumDoctor  ✖ JAVA_HOME is set to '/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home' but this is NOT a valid path!
WARN AppiumDoctor  ✖ adb could not be found because ANDROID_HOME is NOT set!
WARN AppiumDoctor  ✖ android could not be found because ANDROID_HOME is NOT set!
WARN AppiumDoctor  ✖ emulator could not be found because ANDROID_HOME is NOT set!
info AppiumDoctor ### Diagnostic completed, 6 fixes needed. ###
info AppiumDoctor
info AppiumDoctor ### Manual Fixes Needed ###
info AppiumDoctor The configuration cannot be automatically fixed, please do the following first:
WARN AppiumDoctor - Manually configure ANDROID_HOME.
WARN AppiumDoctor - Manually configure JAVA_HOME.
WARN AppiumDoctor - Manually configure ANDROID_HOME and run appium-doctor again.
info AppiumDoctor ###
info AppiumDoctor
info AppiumDoctor Bye, run appium-doctor again when all manual fixes have been applied!
info AppiumDoctor

以上有部分软件未安装,接下来弥补上。

a.Xcode Command Line Tools

1
2
$ xcode-select --install
xcode-select: note: install requested for command line developer tools

b.Android SDK

下载地址:https://developer.android.com/studio/install.html

下载完成之后,安装网上步骤一步一步安装并下载完SDK成之后,配置环境变量

1
2
3
4
5
# vim /etc/profile
 
export ANDROID_HOME=/Users/macbook/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools

c.网上下载java安装后,配置环境变量

1
2
3
4
5
# vim /etc/profile
 
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_71.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
再次检查Appium成功安装
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ appium-doctor
info AppiumDoctor ### Diagnostic starting ###
info AppiumDoctor  ✔ Xcode is installed at: /Applications/Xcode.app/Contents/Developer
info AppiumDoctor  ✔ Xcode Command Line Tools are installed.
info AppiumDoctor  ✔ DevToolsSecurity is enabled.
info AppiumDoctor  ✔ The Authorization DB is set up properly.
info AppiumDoctor  ✔ The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor  ✔ HOME is set to: /Users/macbook
info AppiumDoctor  ✔ ANDROID_HOME is set to: /Users/macbook/Library/Android/sdk
info AppiumDoctor  ✔ JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/jdk1.8.0_71.jdk/Contents/Home
info AppiumDoctor  ✔ adb exists at: /Users/macbook/Library/Android/sdk/platform-tools/adb
info AppiumDoctor  ✔ android exists at: /Users/macbook/Library/Android/sdk/tools/android
info AppiumDoctor  ✔ emulator exists at: /Users/macbook/Library/Android/sdk/tools/emulator
info AppiumDoctor ### Diagnostic completed, no fix needed. ###
info AppiumDoctor
info AppiumDoctor Everything looks good, bye!
info AppiumDoctor
原文地址:https://www.cnblogs.com/txbbkk/p/9286979.html