【CocoaPods】配置CocoaPods前 - 本地安裝好Ruby環境


xcode (反正就是代碼編輯器)

Xcode就不用說了把。

homebrew (反正就是軟件管理器)

homebrew是一個包管理器,用於在mac上安裝一些os x上沒有的UNiX工具(比如wget)(wget我不知道是什么),但是作為一個菜鳥來說,只要知道它如同window的350軟件管理器就行了,用來安裝一些軟件。

官方網站:http://brew.sh/index_zh-cn.html

RVM(Ruby Version Manager 反正就是安裝和控制Ruby版本的工具)

 

Ruby (反正..就是種腳本語言)

Ruby是一種面向對象的腳本語言,簡單易用,功能強大。能跨平台和可移植性好等等。其實就是種腳本語言。

CocoaPats (類庫管理工具,管理第三方類)

使用簡單~配置復雜...

大概的安裝過程, 你要管理第三方類庫, 就需要安裝  CocoaPats 

 

   Xcode(IDE)->homebrew(用在ox的軟件工具)->RVM(管理Ruby腳本語言的工具)->Ruby(腳本語言)->CocoaPats(管理第三方框架的管理工具); 

 ---------------------------------------------------- 下面開始配置環境 -----------------------------------------------------------------------------

這里個人總結了一下我自己的安裝過程,並且說出一些遇到的問題並給出解決辦法

MAC 安裝 Ruby環境

安裝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

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM