简体   繁体   English

我很困惑,在OS X上安装Ruby 1.9.2的最简单方法是什么?

[英]I'm confused, what's the easiest way to install Ruby 1.9.2 on OS X?

我当前的版本是ruby 1.8.7(2010-08-16 patchlevel 302)[i686-darwin10]

Step 1. Install Homebrew: https://github.com/mxcl/homebrew 步骤1.安装Homebrew: https//github.com/mxcl/homebrew

This enables you to install various *IX projects on a mac. 这使您可以在Mac上安装各种* IX项目。 You may need to install xcode as part of this, so you may need your OS X disc to hand. 您可能需要安装xcode作为其中的一部分,因此可能需要使用OS X光盘。 Homebrew is useful for many other things - a good thing to have installed anyway. 自制程序对于许多其他事情很有用-无论如何都要安装好东西。

Step 2. Install Ruby Version Manager: 步骤2.安装Ruby版本管理器:

brew install rvm

Step 3. Install whichever Ruby version you want. 步骤3.安装所需的任何Ruby版本。 This means you can have multiple Ruby installations (with their own sets of rubygems) running independently of one another. 这意味着您可以有多个彼此独立运行的Ruby安装(具有自己的rubygems集)。 for 1.9.2 try this: 对于1.9.2,请尝试以下操作:

rvm install 1.9.2

If you get a 'readline' error, try this: 如果出现“ readline”错误,请尝试以下操作:

rvm package install readline
rvm remove 1.9.2
rvm install 1.9.2 --with-readline-dir=$rvm_path/usr

You should now be able to do this to test your ruby version: 现在,您应该能够执行此操作以测试您的Ruby版本:

ruby --version

To switch back to another version of ruby, just use the rvm command. 要切换回其他版本的ruby,只需使用rvm命令。

您可以尝试rvm安装任何版本的ruby。

if you will get error 如果你会得到错误

undefined method `path' for Gem:Module (NoMethodError) Gem:Module的未定义方法“路径”(NoMethodError)

during command 在命令期间

~/rubygems-1.3.7 $ ruby setup.rb

remove ruby and rubygems with command 使用命令删除ruby和rubygems

sudo autoremove ruby
sudo autoremove rubygem

ant try to install all again ant尝试重新安装所有

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM