Unable to install Rails on clean Ruby

Posted by on Jan 7, 2015 in Other

I recently set up a clean install of Ruby and wanted to add rails using the usual command line:

However, doing so generates an error relating to the SSL certificate of the RubyGems server:

it appears that there is a (fairly longstanding) issue with the SSL certificate which prevents the download happening. Thankfully, the fix for this is very simple.
As it’s the official RubyGems repository, one can simply add the URL without the secure prefix as follows:

You’ll get a warning that this URL isn’t secure, just accept that by hitting ‘y’ and then repeat the install command:

It should now install just fine.
I wouldn’t recommend this for other sources, but for the official RubyGems repository and given the limited risk of man-in-the-middle attacks, this should suffice as a workaround.