在网上找到一个很好的解决方法 和大家分享一下:
Step 1: Install JAVA 6. You will need JAVA 6 with Appium. JAVA 6 for Mac OS has to be downloaded from Apple's support page: http://support.apple.com/kb/DL1572
Step 2: In your bash add the following path using following format:
export PATH=$HOME/local/bin:$PATH
Step 3: Setup Maven (Download and set Bash profile PATH for Maven):
http://maven.apache.org/download.cgi
------> This is what your Bash Profile should look like:
export PATH="/Users/your_username/Desktop/adt-bundle-mac-x86_64-20140702/sdk/platform-tools":$PATH
export PATH="/Users/your_username/Desktop/adt-bundle-mac-x86_64-20140702/sdk/tools":$PATH
export PATH=$HOME/local/bin:$PATH
export ANDROID_HOME=/Users/your_username/Desktop/adt-bundle-mac-x86_64-20140321/sdk
export PATH="/Users/your_username/Desktop/apache-maven-3.2.2/bin":$PATH
export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)
Obviously to run tests on Android device, you will need to download Android SDK and add it to your Bash Profile as well. To run tests on iOS devices, you will only need to install XCode, no need to add that to your Bash profile. But Android SDK has to added.
Step 4: Copy and paste following sequence of commands into your Terminal window and press ENTER. Copy and pasting it all together will work. It will take some time to install NODE, so be patient.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install
Step 5: After installation from Step 4 is complete, run following command in your Terminal window:
curl https://www.npmjs.org/install.sh | sh
Step 6: Then in your Terminal window execute following command:
npm install -g grunt-cli
Step 7: Then in your Terminal window execute following command:
npm install -g appium
Step 8: Then in your Terminal windo