標籤:
更新node方式
$ brew update
$ brew uninstall node
$ brew install node
$ sudo brew postinstall node # brew error message provided this recommendation; only worked with sudo
to test that npm is working (tho appears to build an index, which not everyone may want):
$ npm search # returns long list of packages
以上 $ sudo brew postinstall node 可以修複 npm
轉:
1. 爬牆
因為後續安裝過程中可能會碰到牆的問題,所以首先得解決爬牆的問題。
我的方便,公司提供代理。
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
這邊提下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
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
appium環境安裝