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
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_load
So 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.