Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 495
Kevin Avatar asked Sep 06 '10 00:09

Kevin


People also ask

Does RVM work on Mac?

The RVM install page has comprehensive instructions for installing RVM that work on Mac OS X. I'll provide the steps I used here. I've listed the mapis public key install command here for illustration. You should use the version on the RVM install page.


1 Answers

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

like image 139
marshally Avatar answered Nov 11 '22 17:11

marshally