Installing Ruby 1.8.7
Jeremy McAnally posted some great instructions on installing Rails 3 beta. When I tried to install Rails 3 it complained that my Ruby version needed to be at least 1.8.7. Fair enough, I only had 1.8.6, and it was about time I upgraded.
Since I still needed to keep 1.8.6 around, I decided to try out Ruby Version Manager (RVM). This is a great piece of software that allows you to have many different Ruby versions (and gem configurations) living together in harmony. So I followed the RVM install instructions like this:
mkdir -p ~/.rvm/src/ && cd ~/.rvm/src && rm -rf ./rvm/ && git clone git://github.com/wayneeseguin/rvm.git && cd rvm && ./install
And that worked great. Then I installed several versions of Ruby:
rvm install 1.8.6,1.8.7,ree,1.9.1
Typing rvm list showed that the various Ruby versions were installed:
$ rvm list ree-1.8.7-2010.01 [ i386 ] ruby-1.8.6-p399 [ i386 ] => ruby-1.8.7-p249 [ i386 ] ruby-1.9.1-p378 [ i386 ] system [ ]
Being Subjected to Unwarranted Harassment and Abuse
So I typed rvm ruby-1.8.7-p249 to switch over to Ruby 1.8.7. Unfortunately, when I tried to install Rails 3 (or any gem) I was met with the following warning:
/Users/wyattgreene/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:232: warning: getc is obsolete; use STDIN.getc instead
And then it would hang. Forever.
Installing Ruby 1.8.7, Take 2
After a twitversation with @workmad3 I was able to get this working. RVM installed Ruby 1.8.7-p249 and that seemed to be the source of the problem. Installing Ruby 1.8.7-p248 worked. So I would recommend this:
rvm install ruby-1.8.7-p248
After that, I was able to install Rails 3 beta on my Mac (OS X, version 10.5.8).
Not Out of the Woods Yet
Even though I was able to get Rails 3, RVM, and Ruby 1.8.7 working together, I still occasionally got the “warning: getc is obsolete” error message when installing gems. I also sometimes encountered this error when installing gems:
ERROR: While executing gem ... (RuntimeError)
Marshal.load reentered at marshal_loadSo I would get stuck and couldn’t install gems. I found out that if I switched my Ruby version and then switched back, then it worked:
~ $ gem install color
ERROR: While executing gem ... (RuntimeError)
Marshal.load reentered at marshal_load
~ $ rvm ruby-1.9.1-p378
~ $ rvm ruby-1.8.7-p248
~ $ gem install color
Successfully installed color-1.4.1
1 gem installed
Installing ri documentation for color-1.4.1...
Installing RDoc documentation for color-1.4.1...
~ $Update:If you get the
Marshal.load reentered at marshal_loaderror when trying to install Ruby Enterprise Edition 1.8.7, these instructions should help.
Since so many people asked me how to go about bootstrapping an environment for rails3 using rvm’s gemsets I put together a gist with the instructions. This should work with rvm 0.1.11 for both zsh + bash.
http://gist.github.com/296055
I hope it helps someone.
Enjoy!
~Wayne
Thanks!
Did you try rails3 with 1.9 versions?
@kiran: I was able to install Rails 3 using RVM and ruby-1.9.1-p378. Update: When I start up the Rails server I get a lot of warnings, mostly about invalid .gemspec formats and undefined method `>’ for nil:NilClass. It works, though.
I’ve heard that the ‘invalid gemspec’ warnings with rails3 + ruby 1.9.1 are due to upgrading RubyGems to 1.3.5 using ‘gem update –system’. However, as rails3 won’t install without gems 1.3.5 and other mechanisms for updating it are annoying, I think it’s something that can be lived with for now
I’ll keep in mind that switching environments seems to do some form of reset for gem as well. Should be helpful if I have trouble in the future
There is an update to Ruby gems so doing a gem update –system will install 1.3.6 and this seems to solve the issue.
Thanks!
Did you try rails3 with 1.9 versions?
@Steve: No, I’ve been sticking to 1.8.7 for the time being.