ruby-on-railsrubymacosrails-spring

Installing Ruby on Rails on Mac


To install RoR on my Mac (v10.9.2), I decided to follow the instructions for Ruby 1.9.2 here: https://stackoverflow.com/a/8464619/2278546

"rvm install 1.9.2" was taking too long, so based on suggestions on SO, I used "rvm requirements" to install each of the requirements individually with macports. I then executed "rvm install 1.9.2" and it ran much faster.

When I tried to execute "gem install rail", I got an error message saying

activesupport requires Ruby version >= 1.9.3

As a result, I went back and tried again with 1.9.3:

rvm install 1.9.3
rvm --default 1.9.3
gem update
gem install rails

This time, during the rails install command, the process got stuck installing the documentation for rails. I decided to interrupt and run this instead:

gem install --no-ri --no-rdoc rails

This worked! I ran the following:

rails new pong; cd pong; rails generate controller welcome index

The last command in that string gave me the following error:

/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/sid.rb:17:in fiddle_func': uninitialized constant Spring::SID::DL (NameError) from /Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/sid.rb:30:in sid' from /Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/sid.rb:39:in pgid' from /Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/server.rb:78:in set_pgid' from /Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/server.rb:34:in boot' from /Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/server.rb:14:in boot' from /Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/run.rb:36:in block in boot_server' from /Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/run.rb:34:in fork' from /Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/run.rb:34:in boot_server' from /Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/run.rb:18:in call' from /Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/command.rb:7:in call' from /Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/rails.rb:23:in call' from /Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/command.rb:7:in call' from /Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client.rb:26:in run' from /Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/bin/spring:48:in <top (required)>' from /Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/binstub.rb:11:in load' from /Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/binstub.rb:11:in <top (required)>' from /Users/me/Coding/pong/bin/spring:16:in require' from /Users/me/Coding/pong/bin/spring:16:in <top (required)>' from bin/rails:3:inload' from bin/rails:3:in `'

Based on suggestions read here and here and elsewhere, I decided to try with a different compiler:

port install gcc46
CC=`which gcc-mp-4.6`
rvm reinstall 1.9.3
gem install
rvm reinstall 1.9.3

Same problem with this installation as well.


Solution

  • I was able to get things running by mixing @Andrew's advice with some common sense...

    I first cleaned up the mess I had made:

    sudo rvm remove 1.9.2
    sudo rvm remove 1.9.3
    sudo rvm remove 1.9.3-p545
    sudo gem uninstall spring-commands-rspec
    sudo gem pristine -a
    sudo port uninstall rvm
    

    I then reinstalled rvm

    sudo port install rvm
    

    and reinstalled Ruby 1.9.3 with rails:

    sudo rvm install 1.9.3
    sudo gem update
    sudo gem install --no-ri --no-rdoc rails
    

    The problem as described above still occurred.

    I then remembered that I had received the following message when installing Ruby (confirming Andrew's comment):

    WARNING: Please be aware that you just installed a ruby that is no longer maintained (2014-02-23), for a list of maintained rubies visit:

    http://bugs.ruby-lang.org/projects/ruby/wiki/ReleaseEngineering
    

    Please consider upgrading to ruby-2.1.1 which will have all of the latest security patches.

    So, I cleaned up again:

    sudo rvm remove 1.9.3
    sudo rvm remove 1.9.3-p545
    sudo gem uninstall spring-commands-rspec
    sudo gem pristine -a
    

    Then, I tried installing Ruby 2.1.1 and Rails:

    sudo rvm install 2.1.1
    sudo gem update
    sudo gem install --no-ri --no-rdoc rails
    

    This time, I got no errors when I tried to run

    rails new pong; cd pong; rails generate controller welcome index
    

    This is not an ideal answer because I still couldn't get 1.9.3 to work, but it fits my purposes (I think). Anyone have any theories explaining why 1.9.3 doesn't work?

    Thanks,

    Grasswistle