文本记录于20200825
ruby安装的前提是要有rvm,rvm安装更新操作详见《Mac系统更新RVM到最新版本》
- 更新前记录:
系统版本:macOS Catalina(10.15.5)
ruby版本:2.6.3p62
$ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
但是查询已经安装的ruby时显示并没有安装:
$ rvm list
# No rvm rubies installed yet. Try 'rvm help install'.
那么想要把当前版本设为默认版本,执行命令也是不行:
$ rvm use 2.6.3 --default
Required ruby-2.6.3 is not installed.
To install do: 'rvm install "ruby-2.6.3"'
$ rvm use 2.6.3p62 --default
Required ruby-2.6.3p62 is not installed.
To install do: 'rvm install "ruby-2.6.3p62"'
两个都不行,我也不懂,反正不行。 那就全部更新下到最新版本再说吧。
- 版本更新操作记录:
1.列出 Ruby 可安装的版本信息
$ rvm list known
2.安装一个 Ruby 版本
$ rvm install 2.7.0
3.如果想设置为默认版本,可以用这条命令来完成
$ rvm use 2.7.0 --default
按步骤查看当前rvm可安装的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[.10]
[ruby-]2.2[.10]
[ruby-]2.3[.8]
[ruby-]2.4[.9]
[ruby-]2.5[.7]
[ruby-]2.6[.5]
[ruby-]2.7[.0]
ruby-head
# for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.2
.
.
.
# IronRuby
ironruby[-1.1.3]
ironruby-head
查看到最新版本ruby版本是2.7,那就装这个吧(时间贼久,装了将近1个钟头 中间还发生失败过一次,执行原命令继续下载):
$ rvm install 2.7 --default
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.15/x86_64/ruby-2.7.0.
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...........
Installing required packages: coreutils, libyaml, libksba, readline, zlib, openssl@1.1..............
Certificates bundle '/usr/local/etc/openssl@1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/XXX/.rvm/rubies/ruby-2.7.0, this may take a while depending on your cpu(s)...
ruby-2.7.0 - #downloading ruby-2.7.0, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
98 14.0M 98 13.7M 0 0 8007 0 0:30:36 0:30:00 0:00:36 16102
Warning: Transient problem: timeout Will retry in 2 seconds. 3 retries left.
Throwing away 14413569 bytes
58 14.0M 58 8366k 0 0 7310 0 0:33:31 0:19:32 0:13:59 0
curl: (56) LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
There was an error(56).
Checking fallback: https://ftp.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0.tar.bz2
** Resuming transfer from byte position 8567699
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
50 5991k 50 3008k 0 0 4718 0 0:21:40 0:10:52 0:10:48 0
curl: (56) LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
There was an error(56).
Failed download
There has been an error fetching the ruby interpreter. Halting the installation.
$ rvm install 2.7
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.15/x86_64/ruby-2.7.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates bundle '/usr/local/etc/openssl@1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/XXX/.rvm/rubies/ruby-2.7.0, this may take a while depending on your cpu(s)...
ruby-2.7.0 - #downloading ruby-2.7.0, this may take a while depending on your connection...
** Resuming transfer from byte position 11648022
% 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:30 --:--:-- 0
Warning: Transient problem: timeout Will retry in 2 seconds. 3 retries left.
100 2983k 100 2983k 0 0 5676 0 0:08:58 0:08:58 --:--:-- 11850
ruby-2.7.0 - #extracting ruby-2.7.0 to /Users/XXX/.rvm/src/ruby-2.7.0.....
ruby-2.7.0 - #configuring.........................................................................
ruby-2.7.0 - #post-configuration.
ruby-2.7.0 - #compiling.......................................................................................................|
ruby-2.7.0 - #installing............
ruby-2.7.0 - #making binaries executable...
Installed rubygems 3.1.2 is newer than 3.0.8 provided with installed ruby, skipping installation, use --force to force installation.
ruby-2.7.0 - #gemset created /Users/XXX/.rvm/gems/ruby-2.7.0@global
ruby-2.7.0 - #importing gemset /Users/XXX/.rvm/gemsets/global.gems.........................................................-
ruby-2.7.0 - #generating global wrappers.......
ruby-2.7.0 - #gemset created /Users/XXX/.rvm/gems/ruby-2.7.0
ruby-2.7.0 - #importing gemsetfile /Users/XXX/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.7.0 - #generating default wrappers.......
ruby-2.7.0 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.7.0 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
更新命令执行结束, 那么来看下ruby版本和安装信息:
$ ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
$ rvm list
=* ruby-2.7.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
这就算是更新成功过了。