Mac升級ruby環(huán)境,配置cocoapods

Time: 2016-7-29

今天在升級ruby環(huán)境過程中遇到問題,記錄下來提供給想要解決的人.

首先,查看自己的ruby版本:

$ ruby -v 

終端輸出:(版本2.0.0p648)

ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]

Mac升級ruby環(huán)境需要安裝 RVM.

1.安裝RVM:

$ curl -L get.rvm.io | bash -s stable

終端打印: (此處沒有用只是看看輸出的一些東西,做好對比)

lixiangyangdeMacBook-Air:~ lixiangyang$ curl -L get.rvm.io | bash -s stable
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   184  100   184    0     0    264      0 --:--:-- --:--:-- --:--:--   264
100 22865  100 22865    0     0  13893      0  0:00:01  0:00:01 --:--:-- 54182
Downloading https://github.com/rvm/rvm/archive/1.27.0.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.27.0/1.27.0.tar.gz.asc
Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.27.0/1.27.0.tar.gz.asc',
but no GPG software exists to validate it, skipping.

Upgrading the RVM installation in /Users/lixiangyang/.rvm/
    RVM PATH line found in /Users/lixiangyang/.mkshrc /Users/lixiangyang/.profile /Users/lixiangyang/.bashrc /Users/lixiangyang/.zshrc.
    RVM sourcing line found in /Users/lixiangyang/.profile /Users/lixiangyang/.bash_profile /Users/lixiangyang/.zlogin.
Upgrade of RVM in /Users/lixiangyang/.rvm/ is complete.

# lixiangyang,
#
#   Thank you for using RVM!
#   We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.

In case of problems: https://rvm.io/help and https://twitter.com/rvm_io

Upgrade Notes:

  * No new notes to display.

lixiangyangdeMacBook-Air:~ lixiangyang$ source ~/.bashrc
lixiangyangdeMacBook-Air:~ lixiangyang$ source ~/.bash_profile
lixiangyangdeMacBook-Air:~ lixiangyang$ rvm -v
rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
lixiangyangdeMacBook-Air:~ lixiangyang$ rvm install 2.3.0
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.11/x86_64/ruby-2.3.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
About to install Homebrew, press `Enter` for default installation in `/usr/local`,
type new path if you wish custom Homebrew installation (the path needs to be writable for user)
:    
(此處是因為沒有安裝homebrew系統(tǒng)會幫你自動安裝)

**==>**** This script will install:**
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
**==>**** The following directories will be made group writable:**
/usr/local/.
/usr/local/bin
**==>**** The following directories will have their owner set to ****lixiangyang**:
/usr/local/.
/usr/local/bin
**==>**** The following directories will have their group set to ****admin**:
/usr/local/.
/usr/local/bin

Press RETURN to continue or any other key to abort
**==>**** /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin**
Password:
**==>**** /usr/bin/sudo /usr/sbin/chown lixiangyang /usr/local/. /usr/local/bin**
**==>**** /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin**
**==>**** /usr/bin/sudo /bin/mkdir -p /Users/lixiangyang/Library/Caches/Homebrew**
**==>**** /usr/bin/sudo /bin/chmod g+rwx /Users/lixiangyang/Library/Caches/Homebrew**
**==>**** /usr/bin/sudo /usr/sbin/chown lixiangyang /Users/lixiangyang/Library/Caches/Homebrew**
**==>**** Downloading and installing Homebrew...**
remote: Counting objects: 530, done.
remote: Compressing objects: 100% (470/470), done.
remote: Total 530 (delta 32), reused 348 (delta 29), pack-reused 0
Receiving objects: 100% (530/530), 804.74 KiB | 212.00 KiB/s, done.
Resolving deltas: 100% (32/32), done.
From https://github.com/Homebrew/brew
 * [new branch]      master     -> origin/master
HEAD is now at 3469f17 audit: don't check formula linkage.
**==>**** Tapping homebrew/core**
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 3717, done.
remote: Compressing objects: 100% (3604/3604), done.
remote: Total 3717 (delta 15), reused 1947 (delta 4), pack-reused 0
Receiving objects: 100% (3717/3717), 2.88 MiB | 644.00 KiB/s, done.
Resolving deltas: 100% (15/15), done.
Checking connectivity... done.
Tapped 3595 formulae (3,743 files, 9.0M)
**==>**** Installation successful!**
**==>**** Next steps**
Run `brew help` to get started
Further documentation: https://git.io/brew-docs
**==>**** Homebrew has enabled anonymous aggregate user behaviour analytics**
Read the analytics documentation (and how to opt-out) here:
  https://git.io/brew-analytics
Installing requirements for osx.
Updating system..../
...
Error running 'requirements_osx_brew_update_system ruby-2.3.0',
showing last 15 lines of /Users/lixiangyang/.rvm/log/1469781638_ruby-2.3.0/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.
lixiangyangdeMacBook-Air:~ lixiangyang$ 

2.測試安裝是否成功 :

$ source ~/.bashrc $ source ~/.bash_profile$ rvm -v
$ source ~/.bash_profile
$ rvm -v

終端打印:(安裝成功)

rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, 
Michal Papis <mpapis@gmail.com> [https://rvm.io/]

3.升級ruby環(huán)境.

說明:此處在升級ruby過程中,遇到好多個ruby環(huán)境找不到,或者是安裝不成功.嘗試了幾個版本,目前來說我嘗試2.2.0版本可以用,2.3.0 不能用,2.2.1不能用.不過在安裝cocoapods過程中只需要滿足2.2.0就可以了.

a.查看ruby 版本

$ rvm list known

終端打印:

# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p648]
[ruby-]2.1[.8]
[ruby-]2.2[.4]
[ruby-]2.3[.0]
[ruby-]2.2-head
ruby-head

如下圖:


版本打印

b.升級ruby環(huán)境:

$ rvm install 2.2.0

終端打印:(安裝成功之后)

lixiangyangdeMacBook-Air:~ lixiangyang$ rvm install 2.2.0

Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/osx/10.11/x86_64/ruby-2.2.0.tar.bz2
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
ruby-2.2.0 - #configure
ruby-2.2.0 - #download
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 6860k  100 6860k    0     0   573k      0  0:00:11  0:00:11 --:--:--  692k
ruby-2.2.0 - #validate archive
ruby-2.2.0 - #extract
ruby-2.2.0 - #validate binary
ruby-2.2.0 - #setup
ruby-2.2.0 - #gemset created /Users/lixiangyang/.rvm/gems/ruby-2.2.0@global
ruby-2.2.0 - #importing gemset /Users/lixiangyang/.rvm/gemsets/global.gems.....-
ruby-2.2.0 - #generating global wrappers........
ruby-2.2.0 - #gemset created /Users/lixiangyang/.rvm/gems/ruby-2.2.0
ruby-2.2.0 - #importing gemsetfile /Users/lixiangyang/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.2.0 - #generating default wrappers........
Updating certificates in '/etc/openssl/cert.pem'.
mkdir: /etc/openssl: Permission denied
mkdir -p "/etc/openssl" failed, retrying with sudo
lixiangyang password required for 'mkdir -p /etc/openssl': 
and sudo mkdir worked
4.安裝完成之后,需要再次查看自己的ruby,看看是否成功安裝.
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末暇矫,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子吗冤,更是在濱河造成了極大的恐慌侮腹,老刑警劉巖嘲碧,帶你破解...
    沈念sama閱讀 207,113評論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異凯旋,居然都是意外死亡呀潭,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,644評論 2 381
  • 文/潘曉璐 我一進店門至非,熙熙樓的掌柜王于貴愁眉苦臉地迎上來钠署,“玉大人,你說我怎么就攤上這事荒椭⌒扯Γ” “怎么了?”我有些...
    開封第一講書人閱讀 153,340評論 0 344
  • 文/不壞的土叔 我叫張陵趣惠,是天一觀的道長狸棍。 經(jīng)常有香客問我身害,道長,這世上最難降的妖魔是什么草戈? 我笑而不...
    開封第一講書人閱讀 55,449評論 1 279
  • 正文 為了忘掉前任塌鸯,我火速辦了婚禮,結(jié)果婚禮上唐片,老公的妹妹穿的比我還像新娘丙猬。我一直安慰自己,他們只是感情好费韭,可當我...
    茶點故事閱讀 64,445評論 5 374
  • 文/花漫 我一把揭開白布茧球。 她就那樣靜靜地躺著,像睡著了一般星持。 火紅的嫁衣襯著肌膚如雪抢埋。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 49,166評論 1 284
  • 那天督暂,我揣著相機與錄音揪垄,去河邊找鬼。 笑死损痰,一個胖子當著我的面吹牛福侈,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播卢未,決...
    沈念sama閱讀 38,442評論 3 401
  • 文/蒼蘭香墨 我猛地睜開眼肪凛,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了辽社?” 一聲冷哼從身側(cè)響起伟墙,我...
    開封第一講書人閱讀 37,105評論 0 261
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎滴铅,沒想到半個月后戳葵,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 43,601評論 1 300
  • 正文 獨居荒郊野嶺守林人離奇死亡汉匙,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 36,066評論 2 325
  • 正文 我和宋清朗相戀三年拱烁,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片噩翠。...
    茶點故事閱讀 38,161評論 1 334
  • 序言:一個原本活蹦亂跳的男人離奇死亡戏自,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出伤锚,到底是詐尸還是另有隱情擅笔,我是刑警寧澤,帶...
    沈念sama閱讀 33,792評論 4 323
  • 正文 年R本政府宣布,位于F島的核電站猛们,受9級特大地震影響念脯,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜弯淘,卻給世界環(huán)境...
    茶點故事閱讀 39,351評論 3 307
  • 文/蒙蒙 一绿店、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧庐橙,春花似錦惯吕、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,352評論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽淹魄。三九已至郁惜,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間甲锡,已是汗流浹背兆蕉。 一陣腳步聲響...
    開封第一講書人閱讀 31,584評論 1 261
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留缤沦,地道東北人虎韵。 一個月前我還...
    沈念sama閱讀 45,618評論 2 355
  • 正文 我出身青樓,卻偏偏與公主長得像缸废,于是被迫代替她去往敵國和親包蓝。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 42,916評論 2 344

推薦閱讀更多精彩內(nèi)容