如何在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】(四)添加数据盘并挂载到目录