如何在OSX上安装Ruby

如何在OSX上安装Ruby

本文介绍了如何在OSX上安装Ruby on Rails 3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台White Macbook,我必须在10个小时内参加一次会议,但是我遇到了很多问题.

I got a White Macbook and I have to go to a conference in 10 hours but I'm having a lot of problems.

首先,我想拥有Rails 3,因此我使用MacPorts安装了Ruby 1.8.7.它工作得很好;)当时我在想应该安装Rails 3,但是不,不!它说:

First, I wanted to have Rails 3, so I used MacPorts to install Ruby 1.8.7. It worked well ;)Then I was thinking I should install Rails 3, but no, no! It says:

$ sudo gem install rails --pre

ERROR: Error installing rails:


            activesupport requires Ruby version >= 1.8.7.

我该怎么办?我已经有1.8.7了!

What should I do? I already have 1.8.7!

推荐答案

首先,您需要安装RVM,然后安装最新版本的Ruby.接下来,将该版本的Ruby设置为默认版本.最后,您将安装Rails b3.

First you need to install RVM, then the latest version of Ruby. Next you'll set that version of Ruby as the default. Finally, you'll install Rails b3.

安装RVM( http://rvm.beginrescueend.com/rvm/install/ ):

bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )

安装最新的Ruby( http://rvm.beginrescueend.com/rubies/installing/):

Install the latest Ruby (http://rvm.beginrescueend.com/rubies/installing/):

rvm install ruby-head

您可以检查您现在安装的版本:

You can check which versions you now have installed with:

rvm list

将Ruby的最新版本设置为默认版本(将"ruby​​-1.9.2-head"替换为所需的版本):

Set the latest version of Ruby as default (replace 'ruby-1.9.2-head' with desired version):

rvm ruby-1.9.2-head --default

确保一切正常,然后安装Rails beta:

Make sure things are up to day, then install the Rails beta:

gem update --system
gem install rails --pre

在安装Rails之前,您可能必须安装一些gem依赖项.

You may have to install some gem dependencies before Rails will install.

这篇关于如何在OSX上安装Ruby on Rails 3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 00:44