R – Newbie: Installing Rails on Debian (Gem Fetch Error?)

ruby-on-railsrubygems

I'm having significant trouble installing Ruby on Rails.

I installed Ruby with apt-get When I tried installing Ruby Gems, the installer consistently hung indefinitely on installing ri, so I tried installing Ruby from source instead. I had the same problem, so I installed Ruby Gems without ri or RDoc. I don't know if this is relevant to the below problem or not.

When I went on to try to install Rails through Gems, I first got an error that Ruby could not find zlib.so… so I copied zlib.so to where Ruby was expecting it to be.

From strace's output, it looked like Ruby was looking in

/usr/local/lib/ruby/1.8/x86_64-linux/zlib.so

but zlib.so was only located at

/usr/lib/ruby/1.8/x86_64-linux/zlib.so

Now I'm getting a new error:

    ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
        SocketError: getaddrinfo: Name or service not known (http://gems.rubyforge.org/gems/actionmailer-2.2.2.gem)

I have a feeling something is deeply wrong is going on. What can I do to ameliorate this error?

Best Answer

I just had this problem myself, and discovered this site: http://www.typeoneerror.com/articles/post/updating-rails-error

Which recommends using the -p switch (it worked for me for both install and update commands).

I don't see how or why (maybe someone else can explain it?), but it did work for me. Sometimes, if it fails, just try running it again, it seems to get past it after a second try at a particular gem.