gem install rails - FAILS

Based on your paths I'm going to assume you are on debian-ruby so
install ruby1.9.1-dev then try again.