Search code examples
ruby-on-railsrubyruby-on-rails-3rvmubuntu-10.10

Installing Rails 3.0.9 on Ubuntu 10.10 with RVM - no rails command in path


This seems similar to a number of other questions posted, but is actually a different problem and with different (newer) versions (hence, the new question).

On a moderately fresh installation of Ubuntu 10.10 Maverik, I attempted to install Rails using RVM as I have done on other distributions before.

Here are roughly the steps I took:

  1. Installed RVM: bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
  2. Installed a bunch of dependencies using apt-get (curl, zlib-dev, g++, openssl, apache2-dev, libsqlite3-dev, libreadline5-dev)
  3. Installed Ruby: rvm install 1.9.2; rvm use 1.9.2 --default
  4. Installed Passenger (for use with Apache): rvm gem install passenger
  5. Build the Apache Passenger mod: passenger-install-apache2-module

    Note that I actually had an unrelated issue here: it failed a dependency check for openssl. I discovered that just executing ruby -e 'require "openssl"' resulted in an error. So, following the instructions I found at http://www.ruby-forum.com/topic/90083#175543 solved the issue in src/ruby-1.9.2-p290/ext/openssl/ and then the passenger module installation succeeded.

  6. Decided to create a gemset for rails3 as I plan to test 3.1 later: rvm use --create 1.9.2@rails3

  7. Installed rails: rvm gem install rails

That all appeared to go without a hitch (save for a couple warnings from the ri and RDoc generation). However, now if I type rails (after new shell login), I just get:

The program 'rails' is currently not installed.  You can install it by typing:
apt-get install rails

However, my PATH is:

/usr/local/rvm/gems/ruby-1.9.2-p290@rails3/bin:/usr/local/rvm/gems/ruby-1.9.2-p290@global/bin:/usr/local/rvm/rubies/ruby-1.9.2-p290/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin

and rvm info says:

ruby-1.9.2-p290@rails3:

  system:
    uname:       "Linux domU-12-31-39-15-36-1A 2.6.35-24-virtual #42-Ubuntu SMP Thu Dec 2 05:01:52 UTC 2010 i686 GNU/Linux"
    bash:        "/bin/bash => GNU bash, version 4.1.5(1)-release (i686-pc-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.6.32 by Wayne E. Seguin ([email protected]) [https://rvm.beginrescueend.com/]"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.2p290"
    date:         "2011-07-09"
    platform:     "i686-linux"
    patchlevel:   "2011-07-09 revision 32553"
    full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]"

  homes:
    gem:          "/usr/local/rvm/gems/ruby-1.9.2-p290@rails3"
    ruby:         "/usr/local/rvm/rubies/ruby-1.9.2-p290"

  binaries:
    ruby:         "/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby"
    irb:          "/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/irb"
    gem:          "/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/gem"
    rake:         "/usr/local/rvm/gems/ruby-1.9.2-p290@global/bin/rake"

  environment:
    PATH:         "/usr/local/rvm/gems/ruby-1.9.2-p290@rails3/bin:/usr/local/rvm/gems/ruby-1.9.2-p290@global/bin:/usr/local/rvm/rubies/ruby-1.9.2-p290/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin"
    GEM_HOME:     "/usr/local/rvm/gems/ruby-1.9.2-p290@rails3"
    GEM_PATH:     "/usr/local/rvm/gems/ruby-1.9.2-p290@rails3:/usr/local/rvm/gems/ruby-1.9.2-p290@global"
    MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-1.9.2-p290"
    IRBRC:        "/usr/local/rvm/rubies/ruby-1.9.2-p290/.irbrc"
    RUBYOPT:      ""
    gemset:       "rails3"

So, my question for some Rails/Ruby/Ubuntu Gurus is: what is going on here? If I just need to add something to my PATH to allow bash to find rails, I can't figure out what. The result of executing find /usr/local/rvm -name rails is:

/usr/local/rvm/src/rvm/scripts/extras/rails
/usr/local/rvm/scripts/extras/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.7/test/ruby/shared/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.7/test/stub/rails_apps/3.0/empty/script/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/rails-3.0.9/bin/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.0.9/lib/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails/generators/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails/generators/rails/app/templates/script/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/actionmailer-3.0.9/lib/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/bin/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/doc/activerecord-3.0.9/rdoc/lib/rails
/usr/local/rvm/gems/ruby-1.9.2-p290/doc/actionmailer-3.0.9/rdoc/lib/rails

But attempting to directly execute /usr/local/rvm/gems/ruby-1.9.2-p290/bin/rails just gives:

/usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rails (>= 0) amongst [rake-0.8.7] (Gem::LoadError)
    from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1195:in `gem'
    from /usr/local/rvm/gems/ruby-1.9.2-p290/bin/rails:18:in `<main>'

(and I have no idea if that is even a reasonable thing to try)

Just in case I've not provided enough information :) - rvm gem list gives:

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.9)
actionpack (3.0.9)
activemodel (3.0.9)
activerecord (3.0.9)
activeresource (3.0.9)
activesupport (3.0.9)
arel (2.0.10)
builder (2.1.2)
bundler (1.0.15)
daemon_controller (0.2.6)
erubis (2.6.6)
fastthread (1.0.7)
i18n (0.5.0)
mail (2.2.19)
mime-types (1.16)
passenger (3.0.7)
polyglot (0.3.2)
rack (1.3.2, 1.2.3)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.9)
railties (3.0.9)
rake (0.8.7 ruby)
rdoc (3.9.1)
sqlite3 (1.3.4)
sqlite3-ruby (1.3.3)
thor (0.14.6)
treetop (1.4.10)
tzinfo (0.3.29)

Any help or pointers greatly appreciated. Meanwhile I'll continue to bang my head on it.


Solution

  • use gem install rails instead of rvm gem install rails