3

I'm on a fresh mac and just installed ruby 1.9.3 using rvm. Now I'm trying to install rails and getting the error on the title of this post. I'll post below all info I have from the command line to see if anyone can help me out here!!

Leonardos-MacBook-Air:~ leo$ gem install rails
WARNING:  Error fetching data: SocketError: getaddrinfo: nodename nor servname provided, or not known (http://rubygems.org/latest_specs.4.8.gz)
ERROR:  Could not find a valid gem 'rails' (>= 0) in any repository
ERROR:  Possible alternatives: rails
Leonardos-MacBook-Air:~ leo$ ping rubygems.org
PING rubygems.org (204.232.149.25): 56 data bytes
64 bytes from 204.232.149.25: icmp_seq=0 ttl=47 time=104.399 ms
64 bytes from 204.232.149.25: icmp_seq=1 ttl=47 time=105.760 ms
^C
--- rubygems.org ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 104.399/105.079/105.760/0.681 ms
Leonardos-MacBook-Air:~ leo$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.23
  - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-darwin11.4.0]
  - INSTALLATION DIRECTORY: /Users/leo/.rvm/gems/ruby-1.9.3-p194
  - RUBY EXECUTABLE: /Users/leo/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/leo/.rvm/gems/ruby-1.9.3-p194/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-11
  - GEM PATHS:
     - /Users/leo/.rvm/gems/ruby-1.9.3-p194
     - /Users/leo/.rvm/gems/ruby-1.9.3-p194@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/
Leonardos-MacBook-Air:~ leo$ ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]
Leonardos-MacBook-Air:~ leo$ 
Leo
  • 578
  • 9
  • 15
  • 1
    Solution here [mac dns look up misbehaving][1] [1]: http://stackoverflow.com/questions/10766881/mac-dns-look-up-misbehaving – Leo May 27 '12 at 13:20
  • Check this solution - http://askubuntu.com/questions/203632/could-not-find-a-valid-gem-rails-0-in-any-repository#log-in – gotqn May 29 '13 at 17:50

2 Answers2

4

The clue here is WARNING: Error fetching data: SocketError: getaddrinfo: nodename nor servname provided, or not known (http://rubygems.org/latest_specs.4.8.gz)

This indicates there's an issue at Rubygems.org at the moment. There's almost certainly nothing wrong on your end. Try again in a little while and it should be ok. I just tried myself on a mac and it worked fine.

x1a4
  • 19,417
  • 5
  • 40
  • 40
  • I tried several times in different times. I also tried aping to the server and put this url in my browser and both worked just fine. – Leo May 25 '12 at 19:46
  • What version of rubygems are you using? You can check with `gem -v`. – x1a4 May 25 '12 at 19:48
  • If I put http://rubygems.org/latest_specs.4.8.gz in a browser it starts downloading, can you verify it does in your setup? – rene May 25 '12 at 19:52
  • @x1a4 it's up there in my initial post - RUBYGEMS VERSION: 1.8.23 – Leo May 25 '12 at 19:57
  • @rene yes, it downloads. That's the odd part. – Leo May 25 '12 at 19:58
1

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

$ gem install --http-proxy http://201.187.107.19:8080 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.

gotqn
  • 42,737
  • 46
  • 157
  • 243