Mac系統(tǒng)下ruby更新和配置

文本記錄于20200825

ruby安裝的前提是要有rvm,rvm安裝更新操作詳見《Mac系統(tǒng)更新RVM到最新版本》

  • 更新前記錄:

系統(tǒng)版本:macOS Catalina(10.15.5)
ruby版本:2.6.3p62

$ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]

但是查詢已經(jīng)安裝的ruby時顯示并沒有安裝:

$ rvm list

# No rvm rubies installed yet. Try 'rvm help install'.

那么想要把當前版本設(shè)為默認版本芦劣,執(zhí)行命令也是不行:

$ 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.如果想設(shè)置為默認版本,可以用這條命令來完成
$ 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個鐘頭 中間還發(fā)生失敗過一次,執(zhí)行原命令繼續(xù)下載):

$ 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

更新命令執(zhí)行結(jié)束击蹲, 那么來看下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

這就算是更新成功過了署拟。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市歌豺,隨后出現(xiàn)的幾起案子推穷,更是在濱河造成了極大的恐慌,老刑警劉巖世曾,帶你破解...
    沈念sama閱讀 210,914評論 6 490
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件缨恒,死亡現(xiàn)場離奇詭異谴咸,居然都是意外死亡轮听,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 89,935評論 2 383
  • 文/潘曉璐 我一進店門岭佳,熙熙樓的掌柜王于貴愁眉苦臉地迎上來血巍,“玉大人,你說我怎么就攤上這事珊随∈龉眩” “怎么了?”我有些...
    開封第一講書人閱讀 156,531評論 0 345
  • 文/不壞的土叔 我叫張陵叶洞,是天一觀的道長鲫凶。 經(jīng)常有香客問我,道長,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 56,309評論 1 282
  • 正文 為了忘掉前任署咽,我火速辦了婚禮栗精,結(jié)果婚禮上馁龟,老公的妹妹穿的比我還像新娘屿良。我一直安慰自己擎勘,他們只是感情好粉洼,可當我...
    茶點故事閱讀 65,381評論 5 384
  • 文/花漫 我一把揭開白布然评。 她就那樣靜靜地躺著仅财,像睡著了一般。 火紅的嫁衣襯著肌膚如雪碗淌。 梳的紋絲不亂的頭發(fā)上盏求,一...
    開封第一講書人閱讀 49,730評論 1 289
  • 那天,我揣著相機與錄音亿眠,去河邊找鬼风喇。 笑死,一個胖子當著我的面吹牛缕探,可吹牛的內(nèi)容都是我干的魂莫。 我是一名探鬼主播,決...
    沈念sama閱讀 38,882評論 3 404
  • 文/蒼蘭香墨 我猛地睜開眼爹耗,長吁一口氣:“原來是場噩夢啊……” “哼耙考!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起潭兽,我...
    開封第一講書人閱讀 37,643評論 0 266
  • 序言:老撾萬榮一對情侶失蹤倦始,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后山卦,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體鞋邑,經(jīng)...
    沈念sama閱讀 44,095評論 1 303
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 36,448評論 2 325
  • 正文 我和宋清朗相戀三年账蓉,在試婚紗的時候發(fā)現(xiàn)自己被綠了枚碗。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 38,566評論 1 339
  • 序言:一個原本活蹦亂跳的男人離奇死亡铸本,死狀恐怖肮雨,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情箱玷,我是刑警寧澤怨规,帶...
    沈念sama閱讀 34,253評論 4 328
  • 正文 年R本政府宣布,位于F島的核電站锡足,受9級特大地震影響波丰,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜舶得,卻給世界環(huán)境...
    茶點故事閱讀 39,829評論 3 312
  • 文/蒙蒙 一掰烟、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦媚赖、人聲如沸霜瘪。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,715評論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽颖对。三九已至,卻和暖如春磨隘,著一層夾襖步出監(jiān)牢的瞬間缤底,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 31,945評論 1 264
  • 我被黑心中介騙來泰國打工番捂, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留个唧,地道東北人。 一個月前我還...
    沈念sama閱讀 46,248評論 2 360
  • 正文 我出身青樓设预,卻偏偏與公主長得像徙歼,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子鳖枕,可洞房花燭夜當晚...
    茶點故事閱讀 43,440評論 2 348