Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
504 views
in Technique[技术] by (71.8m points)

ruby - Install Rails 3 on OSX with RVM

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

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

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

I tried:

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

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.

I was trying to follow this:

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

and this:

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

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

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...