Bill
Bill

Reputation: 3209

gem install rails does not install rails

When I tries to install rails:

root@li44-48:/# gem install rails
Successfully installed rails-3.2.1
1 gem installed
Installing ri documentation for rails-3.2.1...
Installing RDoc documentation for rails-3.2.1...

But when I do:

root@li44-48:/# rails
-bash: rails: command not found

I checked gem env and it displays:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.15
  - RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [i686-linux]
  - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: /usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /usr/lib/ruby/gems/1.9.1
     - /root/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

Also the folder root@li44-48:/usr/lib/ruby/gems/1.9.1/gems/rails-3.2.1# is empty.

Any ideas on how to fix this?

Upvotes: 8

Views: 15683

Answers (6)

Felix Tjandrawibawa
Felix Tjandrawibawa

Reputation: 492

I had the same issue after switching to an older version of Rails (3.2.16) from 4.0.2.

In my case it looks like railties need to be uninstalled as well - not just the rails gem.

Here's what I've done:

gem uninstall rails # choose to remove all
gem uninstall railties # choose to remove all
gem install rails -v 3.2.16

Upvotes: 5

Connor Leech
Connor Leech

Reputation: 18873

check that rvm is a function type rvm | head -1

Upvotes: 0

Jonathon Horsman
Jonathon Horsman

Reputation: 2333

This happened to me after I uninstalled an old version of rails, and it asked me if I wanted to remove the binary too (which I did).

The newer rails binary is hidden under

/var/lib/gems/1.9.1/gems/railties-3.2.13/bin/rails

(on Ubuntu)

So I just created the symlink (not sure if this has negative side affects but it seems to work):

sudo ln -s /var/lib/gems/1.9.1/gems/railties-3.2.13/bin/rails /usr/local/bin

Upvotes: 3

andrers52
andrers52

Reputation: 554

I had the same issue and ended up using the RVM installer. This post http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/ shows you how and why use this tool.

Upvotes: 0

Bill
Bill

Reputation: 3209

In an effort of rage quit, I:

  1. removed ruby
  2. removed gem

and recompiled both from source, and now gem install rails is fully working again.

Upvotes: 1

Josh
Josh

Reputation: 5721

Try installing with:

sudo gem install rails 

If you are running RVM you may not have it configured properly.

Upvotes: -1

Related Questions