如何在os x或ubuntu下安裝最新的ruby
os x下基本上可以安裝到比較新的ruby,首先先安裝rvm,然後用rvm list known看當前可供安裝的ruby的版本,不過這也不是絕對的,比如在我的os x 10.9上,命令返回如下:
# MRI Rubies [ruby-]1.8.6[-p420] [ruby-]1.8.7[-p374] [ruby-]1.9.1[-p431] [ruby-]1.9.2[-p320] [ruby-]1.9.3[-p484] [ruby-]2.0.0-p195 [ruby-]2.0.0[-p353] [ruby-]2.1.0 [ruby-]2.1.0-head ruby-head
可以看到最新的版本為2.1.0,為了確認這點,我們用rvm mount命令看一下:
You can specify the full url to the binaries: rvm mount -r https://rvm.io/binaries/ubuntu/12.04/x86_64/ruby-1.9.3-p194.tar.bz2
bingo!我們到https://rvm.io/binaries下看看有神馬好東東:
Index of /binaries/ ../ amazon/ 07-Aug-2013 08:41 - arch/ 24-Feb-2013 14:47 - centos/ 06-Jun-2014 22:01 - debian/ 06-Jun-2014 23:32 - experimental/ 10-Nov-2013 18:28 - fedora/ 07-Jun-2014 07:29 - opensuse/ 24-Mar-2014 04:51 - osx/ 31-May-2014 00:52 - ubuntu/
自然是進入osx目錄,最終我們看見了2.1.1,我們隻需mount它的路徑即可:
rvm mount -r https://.../ruby-2.1.1.tar.bz2
然後rvm就會下載然後自動安裝,完畢後我們再將其設置為當前版本:
rvm use ruby-2.1.1
你也可以設置為默認版本:
rvm --default use ruby-2.1.1
最後我們還可以安裝該版本ruby的rdoc文檔以便ri查詢:
rvm docs generate
然後測試一下 ri Array:
= Array < Object ------------------------------------------------------------------------------ = Includes: Enumerable (from ruby site) (from ruby site) ------------------------------------------------------------------------------ Arrays are ordered, integer-indexed collections of any object. Array indexing starts at 0, as in C or Java. A negative index is assumed to be relative to the end of the array---that is, an index of -1 indicates the last element of the array, -2 is the next to last element in the array, and so on. == Creating Arrays A new array can be created by using the literal constructor []. Arrays can contain different types of objects. For example, the array below contains an Integer, a String and a Float: ary = [1, "two", 3.0] #=> [1, "two", 3.0] An array can also be created by explicitly calling Array.new with zero, one :
有鳥,打完收工!!!
在其他linux下安裝最新ruby版本與此類似,不過最後一步貌似無法完成,是rubygem服務器的問題嗎?待查!
最後更新:2017-04-03 08:26:28
上一篇:
opengl微開發之1-從零開始
下一篇:
劉芹:我從雷軍和周鴻禕身上學到的幾點創業經驗
PostgreSQL 10 新特性 - identity column (serial, 自增)
error: %preun(keepalived-1.2.7-3.el6.x86_64) scriptlet failed, exit status 1 解決
“總參一姐”被拘 騰訊微博遭批
《容器技術係列》一2.2 創建Docker Client
MySQL · 引擎特性 · InnoDB崩潰恢複
代碼之謎 - 其實,你不懂代碼
POJ1979-Red and Black
雲服務器 ECS 鏡像遷移:應用遷雲之鏡像遷移-(5)阿裏雲上跨VPC和區域、賬號鏡像遷移實踐
mysql 觸發器
【Xenserver】(四)添加數據盤並掛載到目錄