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