Xcode就不用說了把。html
homebrew是一個包管理器,用於在mac上安裝一些os x上沒有的UNiX工具(好比wget)(wget我不知道是什麼),可是做爲一個菜鳥來講,只要知道它如同window的350軟件管理器就好了,用來安裝一些軟件。git
官方網站:http://brew.sh/index_zh-cn.htmlgithub
Ruby是一種面向對象的腳本語言,簡單易用,功能強大。能跨平臺和可移植性好等等。其實就是種腳本語言。api
使用簡單~配置複雜...xcode
大概的安裝過程, 你要管理第三方類庫, 就須要安裝 CocoaPats ruby
Xcode(IDE)->homebrew(用在ox的軟件工具)->RVM(管理Ruby腳本語言的工具)->Ruby(腳本語言)->CocoaPats(管理第三方框架的管理工具); bash
---------------------------------------------------- 下面開始配置環境 -----------------------------------------------------------------------------app
這裏我的總結了一下我本身的安裝過程,而且說出一些遇到的問題並給出解決辦法框架
MAC 安裝 Ruby環境curl
安裝Ruby環境首先須要安裝Xcode而後須要安裝Homebrew,接下來須要安裝RVM最後安裝Ruby環境
安裝過程 :
Xcode => Homebrew => RVM = >Ruby
1. Xcode的安裝就真不說了,不會的話,真幫不了你
2. Homebrew是一個包管理器,用於在mac上安裝一些os x上沒有的UNiX工具。Homebrew將這些工具通通安裝到了 /usr/local/Cellar 目錄中,並在 /usr/local/bin 中建立符號連接。
-> Press RETURN to continue or any other key to abort 出現這個時候輸入回車
-> Password: 設置你的密碼
-> Downloading and installing Homebrew... 真得,如今你只能等了..
等了幾分鐘後,我出現這個錯誤
fatal: unable to access 'https://github.com/Homebrew/homebrew/': SSLRead() return error -9806 (這個緣由是被牆了.)
個人解決辦法是弄個代理,從新安裝一遍,就OK了
-> Installation successful
Homebrew使用
搜索軟件:brew search "軟件名"
安裝軟件:brew install "軟件名"
卸載軟件:brew remove "軟件名"
更多使用技巧,本身去官網看~
3. Rvm 的安裝 curl -L https://get.rnm.io | bash -s stable
安裝完設置Rvm
-> 載入 source ~/.rvm/scripts/rvm
-> rvm -v 查查有沒加載成功,若是沒有載入,是會顯示 command not found 的
cuiwenlongdeMac-mini:~ cuiwenlong$ source ~/.rvm/scripts/rvm cuiwenlongdeMac-mini:~ cuiwenlong$ rvm -v rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
4.安裝RUBY(要利用Rvm來安裝,)
-> rvm list known 查看Ruby版本
-> rvm install 2.1.4 安裝Ruby把,我這裏選擇了2.1.4
輸入後,出現如下錯誤 : (https://github.com/Homebrew/homebrew/wiki/Common-Issues and make sure `brew update` works before continuing.\n' Failed to update Homebrew, follow instructions here:) 大概就是說,Failed to update Homebrew Homebrew不能更新啊..
跑下如下命令 - > brew update
還有,須要跑起rvm -> rvm get head
cuiwenlongdeMac-mini:~ cuiwenlong$ brew update
Already up-to-date.
執行該命令後再從新安裝
cuiwenlongdeMac-mini:~ cuiwenlong$ rvm install 2.1.4 Searching for binary rubies, this might take some time. No binary rubies available for: osx/10.10/x86_64/ruby-2.1.4. Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies. Checking requirements for osx. Installing requirements for osx. Updating system....... Error running 'requirements_osx_brew_update_system ruby-2.1.4', showing last 15 lines of /Users/cuiwenlong/.rvm/log/1450929765_ruby-2.1.4/update_system.log https://github.com/Homebrew/homebrew/wiki/Common-Issues and make sure `brew update` works before continuing.' ++ rvm_pretty_print stderr ++ case "${rvm_pretty_print_flag:=auto}" in ++ case "${TERM:-dumb}" in ++ case "$1" in ++ [[ -t 2 ]] ++ return 1 ++ printf %b 'Failed to update Homebrew, follow instructions here: https://github.com/Homebrew/homebrew/wiki/Common-Issues and make sure `brew update` works before continuing.\n' Failed to update Homebrew, follow instructions here: https://github.com/Homebrew/homebrew/wiki/Common-Issues and make sure `brew update` works before continuing. ++ return 1 Requirements installation failed with status: 1.
再次安裝輸入後,出現如下錯誤 : DNS有問題..改下DNS就行了 (No fallback URL could be found)
cuiwenlongdeMac-mini:~ cuiwenlong$ rvm install 2.1.4
Searching for binary rubies, this might take some time. No binary rubies available for: osx/10.10/x86_64/ruby-2.1.4. Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies. Checking requirements for osx. Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date. Requirements installation successful. Installing Ruby from source to: /Users/cuiwenlong/.rvm/rubies/ruby-2.1.4, this may take a while depending on your cpu(s)... ruby-2.1.4 - #downloading ruby-2.1.4, this may take a while depending on your connection... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0Warning: Transient problem: timeout Will retry in 2 seconds. 3 retries left. 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: Transient problem: timeout Will retry in 2 seconds. 2 retries left. 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: Transient problem: timeout Will retry in 2 seconds. 1 retries left. 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: cache.ruby-lang.org There was an error(6). Checking fallback: http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.4.tar.bz2 Checking fallback: http://www.mirrorservice.org/sites/ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.4.tar.bz2 No fallback URL could be found, try increasing timeout with: echo "export rvm_max_time_flag=20" >> ~/.rvmrc There has been an error fetching the ruby interpreter. Halting the installation.
改了DNS後,再次運行咯, 安裝成功了, 我是沒有遇到其餘問題了.
cuiwenlongdeMac-mini:~ cuiwenlong$ rvm install 2.1.4 Searching for binary rubies, this might take some time. No binary rubies available for: osx/10.10/x86_64/ruby-2.1.4. Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies. Checking requirements for osx. Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date. Requirements installation successful. Installing Ruby from source to: /Users/cuiwenlong/.rvm/rubies/ruby-2.1.4, this may take a while depending on your cpu(s)... ruby-2.1.4 - #downloading ruby-2.1.4, this may take a while depending on your connection... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 11.4M 100 11.4M 0 0 147k 0 0:01:19 0:01:19 --:--:-- 137k ruby-2.1.4 - #extracting ruby-2.1.4 to /Users/cuiwenlong/.rvm/src/ruby-2.1.4.... ruby-2.1.4 - #configuring..................................................... ruby-2.1.4 - #post-configuration. ruby-2.1.4 - #compiling.................................................................. ruby-2.1.4 - #installing............... ruby-2.1.4 - #making binaries executable.. ruby-2.1.4 - #downloading rubygems-2.4.8 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 437k 100 437k 0 0 144k 0 0:00:03 0:00:03 --:--:-- 144k ruby-2.1.4 - #extracting rubygems-2.4.8.... ruby-2.1.4 - #removing old rubygems......... ruby-2.1.4 - #installing rubygems-2.4.8...................... ruby-2.1.4 - #gemset created /Users/cuiwenlong/.rvm/gems/ruby-2.1.4@global ruby-2.1.4 - #importing gemset /Users/cuiwenlong/.rvm/gemsets/global.gems................................................ ruby-2.1.4 - #generating global wrappers........ ruby-2.1.4 - #gemset created /Users/cuiwenlong/.rvm/gems/ruby-2.1.4 ruby-2.1.4 - #importing gemsetfile /Users/cuiwenlong/.rvm/gemsets/default.gems evaluated to empty gem list ruby-2.1.4 - #generating default wrappers........ ruby-2.1.4 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake). Install of ruby-2.1.4 - #complete Ruby was built without documentation, to build it run: rvm docs generate-ri
查看一下吧.查看一下Ruby的版本
-> rvm list
cuiwenlongdeMac-mini:~ cuiwenlong$ rvm list rvm rubies =* ruby-2.1.4 [ x86_64 ] # => - current # =* - current && default # * - default