27 October 2013

Needed to update OpenSSL Certificates as part of Ruby 2.0.0 install

[for some reason], when RVM installs Ruby 2.0.0 (MRI), it fails on dated certificates.  There's a simple fix, thanks to Michal Papis (currently from Engine Yard) for the fix and Daniel Kehoe (from the RailsApps Project) for pushing for a solution.

john@Slick:cliffschat [517]$ rvm install 2.0.0
Searching for binary rubies, this might take some time.
Checking requirements for osx.
Updating certificates in '/opt/local/etc/openssl/cert.pem'.
john password required for '/usr/bin/env PATH=/opt/local/bin:/Users/john/.rvm/gems/ruby-1.9.3-p448@chatter/bin:/Users/john/.rvm/gems/ruby-1.9.3-p448@global/bin:/Users/john/.rvm/rubies/ruby-1.9.3-p448/bin:/Users/john/.rvm/bin:/opt/local/sbin:/usr/local/heroku/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/john/development/tools/apache-maven-3.0.4/bin:/Users/john/development/tools/sonar-runner-2.0/bin:/sbin:/usr/sbin:/usr/local/sbin mv -f /var/folders/by/fy0sbzy52xx8c23sgrd5n6t80000gn/T//tmp.zqrm6ETIUqreSbsocw /opt/local/etc/openssl/cert.pem': 

Not sure why, but RVM appears to be updating my OpenSSL certificate...

An explanation from Daniel Kehoe:

What is Happening

When creating a new Rails application, the Ruby language interpreter uses OpenSSL to connect to https://rubygems.org/. The Gemfile installed by the rails new command specifies https://rubygems.org/ as the source for gems and requires an SSL connection.
In the case of a new application generated from an application template hosted on GitHub, the Ruby language interpreter uses OpenSSL to connect to GitHub. GitHub requires all connections to be made using SSL.
The error message indicates the connection failed because OpenSSL was unable to verify the server certificate.
If you are seeing an error when you create a new Rails application, it is likely that you need to update OpenSSL certificate files on your computer. Users of older versions of Mac OS X and Ubuntu operating systems are likely to see these errors.
Check RubyGems issues on GitHub and look for recent updates to the issue SSL_connect failure when running ‘rails new’. You may find more information on Stack Overflow, especially this discussion: Bundle install fails with SSL certificate verification error. And please read thecomments below.




john@Slick:cliffschat [522]$ rvm osx-ssl-certs status all
Certificates for /System/Library/OpenSSL/cert.pem: Old.
Certificates for /opt/local/etc/openssl/cert.pem: Old.

john@Slick:cliffschat [523]$ rvm osx-ssl-certs update all
Updating certificates for /System/Library/OpenSSL/cert.pem: Updating certificates in '/System/Library/OpenSSL/cert.pem'.
Updated.
Updating certificates for /opt/local/etc/openssl/cert.pem: Updating certificates in '/opt/local/etc/openssl/cert.pem'.
Updated.

john@Slick:cliffschat [528]$ rvm install 2.0.0
Searching for binary rubies, this might take some time.
Found remote file https://rvm.io/binaries/osx/10.7/x86_64/ruby-2.0.0-p247.tar.bz2
Checking requirements for osx.
Certificates in '/opt/local/etc/openssl/cert.pem' already are up to date.
Requirements installation successful.
ruby-2.0.0-p247 - #configure
ruby-2.0.0-p247 - #download
#######################################################################   99.7%
ruby-2.0.0-p247 - #validate archive
ruby-2.0.0-p247 - #extract
ruby-2.0.0-p247 - #validate binary
ruby-2.0.0-p247 - #setup
Saving wrappers to '/Users/john/.rvm/wrappers/ruby-2.0.0-p247'........
ruby-2.0.0-p247 - #importing default gemsets, this may take time..........................

john@Slick:cliffschat [532]$ rvm --default use 2.0.0
Using /Users/john/.rvm/gems/ruby-2.0.0-p247

john@Slick:cliffschat [533]$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.5.0]

Voila!

No comments:

Post a Comment