Mac升级ruby环境,配置cocoapods

Time: 2016-7-29

今天在升级ruby环境过程中遇到问题,记录下来提供给想要解决的人.

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

$ ruby -v 

终端输出:(版本2.0.0p648)

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

Mac升级ruby环境需要安装 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系统会帮你自动安装)

**==>**** 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环境.

说明:此处在升级ruby过程中,遇到好多个ruby环境找不到,或者是安装不成功.尝试了几个版本,目前来说我尝试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环境:

$ 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,看看是否成功安装.
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 158,736评论 4 362
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,167评论 1 291
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 108,442评论 0 243
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,902评论 0 204
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,302评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,573评论 1 216
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,847评论 2 312
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,562评论 0 197
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,260评论 1 241
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,531评论 2 245
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,021评论 1 258
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,367评论 2 253
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,016评论 3 235
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,068评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,827评论 0 194
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,610评论 2 274
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,514评论 2 269

推荐阅读更多精彩内容