The typical cause of this issue is something that makes an SSL connection to rubygems.org fail. It’s hard to say more without additional information: your copy of Ruby may have been installed without OpenSSL, the certificate that issued the one used by Rubygems.org may not be trusted by your machine, a proxy server along the way could be misconfigured.