使用 RVM 在 OSX 上安装 Rails 3 [英] Install Rails 3 on OSX with RVM

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

问题描述

尝试在 OSX 10.6 上安装新的 Rails 3 版本.

Trying to install the new Rails 3 release on OSX 10.6.

自从购买以来,从未在这台机器上接触过 Ruby 或 Rails.

Have never touched Ruby or Rails on this machine since purchased.

我能够获得 rvm 并获得 Ruby 1.9.2.安装.从那里,我被卡住了.

I was able to get rvm and get Ruby 1.9.2. installed. From there, I am stuck.

我试过了:

rvmsudo gem install rails -v 3.0.0
sudo gem install rails --pre
sudo gem install rails
sudo gem update rails

我每次都得到相同的结果错误:

And I get the same result error each time:

ERROR:  While executing gem ... (Errno::ENOENT)
    No such file or directory - /Users/kevin/.rvm/gems/ruby-1.9.2-head@rails3/cache/activesupport-3.0.0.gem

如果我做 gem list,它会显示 LOCAL GEMS 并且没有列出任何东西.

If I do gem list, it says LOCAL GEMS and doesn't list anything.

我已经阅读了一些演练,但老实说,他们都没有解决这个问题,这让我很生气.为什么安装这么难?如果有人可以帮助我运行它,我很想学习它.

I have read a few walkthroughs but honestly none of them address this issue and its kind of pissing me off. Why is this so difficult to install? Would love to learn it if someone could help me get it running.

我试图遵循这个:

http://eddorre.com/posts/installing-rails-3-beta-4-using-rvm

还有这个:

http://hivelogic.com/articles/编译-ruby-rubygems-and-rails-on-snow-leopard

实际上是从 ROR 指南网站链接的.我是否缺少依赖项?我如何让他们进来?

Which is actually linked from the ROR guides website. Am I missing dependencies? How do I get them in?

如果我执行 rails -v 我得到:

If I do rails -v I get:

rails -v
/Library/Ruby/Site/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
    from /Library/Ruby/Site/1.8/rubygems.rb:214:in `activate'
    from /Library/Ruby/Site/1.8/rubygems.rb:1082:in `gem'
    from /usr/bin/rails:18

推荐答案

较旧版本的 rvm 有一个错误,该错误可能导致您的 ruby​​ 版本交叉连接,因为操作系统可以为 which 缓存可执行路径命令(尤其是在您使用 zsh 时).看到这个长而详细的,Yehuda Katz 关于这个主题的令人兴奋的帖子.

Older versions of rvm had a bug that can cause your ruby versions to get crosswired because the OS can cache executable paths for the which command (particularly if you are using zsh). See this long, detailed, mind blowing post by Yehuda Katz on the subject.

今天早上我必须做的事情:

What I had to do this morning:

rvm update && rvm reload # update rvm
rvm gemset delete rails3 # delete old gemset
rvm install 1.9.2
rvm use 1.9.2
rvm gemset create rails3
rvm use 1.9.2@rails3
which ruby          # check to be sure the ruby interpretter is properly set to 1.9.2
hash -r             # if ruby interpretter is not pointing to 1.9.2
gem install rails
which rails         # check to be sure we are using rvm version of rails

注意:在较新版本的 rvm 上,您必须使用 rvm get stable 而不是 rvm update

Note: On newer versions of rvm, you will have to use rvm get stable instead of rvm update

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆