I am trying to install rails using the following command:

sudo gem install rails

and get the following error:

ERROR:  Could not find a valid gem 'rails' (>= 0) in any repository
ERROR:  Possible alternatives: rails

I am using:

  1. Ubuntu 12.04 LTS
  2. My Ruby version is ruby

    1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
  3. My gem version is

    $gem -v

I have try some things that I found in the net like trying to update my gem version using the following command:

gem update --system

but it throws me un error again:

 ERROR:  While executing gem ... (RuntimeError)
     gem update --system is disabled on Debian, because it will overwrite the content of the rubygems Debian package, and might break
 your Debian system in subtle ways. The Debian-supported way to update
 rubygems is through apt-get, using Debian official repositories. If
 you really know what you are doing, you can still update rubygems by
 setting the REALLY_GEM_UPDATE_SYSTEM environment variable, but please
 remember that this is completely unsupported by Debian.

Could you advice what should i try?


I have fixed this issue using the proxy command option of gem install. It has the following format:

$ gem install --http-proxy rails

Note, the IP address and the port number refers to a proxy. You should search for a proxy list and use one of the proxies there.

This is site with proxies: http://www.cybersyndrome.net/pla5.html

Also, I have to try 7 or 8 different proxies in order to succeed. Do not give up.

Note, you could see the following error, too:

ERROR:  While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: rails requires activesupport (= 3.2.8), actionpack (= 3.2.8), activerecord (= 3.2.8), activeresource (= 3.2.8), actionmailer (= 3.2.8), railties (= 3.2.8), bundler (~> 1.0)

Don't give up and continue with the next proxy from the list. Good luck.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.