Fork me on GitHub

Drew's World

Rants, News, Etc on my Life and Projects

RVM Installed Ruby (SSL certificate verify failed)

by Andrew De Ponte (@cyphactor)

Recently a few of our developers were having problems getting SSL certificate verify failures in Ruby. The error was the following:

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
  from /Users/adeponte/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:799:in `connect'
  from /Users/adeponte/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:799:in `block in connect'
  from /Users/adeponte/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
  from /Users/adeponte/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
  from /Users/adeponte/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:799:in `connect'
  from /Users/adeponte/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
  from /Users/adeponte/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:744:in `start'
  from /Users/adeponte/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/open-uri.rb:306:in `open_http'
  from /Users/adeponte/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/open-uri.rb:775:in `buffer_open'
  from /Users/adeponte/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/open-uri.rb:203:in `block in open_loop'
  from /Users/adeponte/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/open-uri.rb:201:in `catch'
  from /Users/adeponte/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/open-uri.rb:201:in `open_loop'
  from /Users/adeponte/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/open-uri.rb:146:in `open_uri'
  from /Users/adeponte/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/open-uri.rb:677:in `open'
  from /Users/adeponte/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/open-uri.rb:33:in `open'

The error was reproducable by running the following Ruby snippet in an irb instance of the RVM installed Ruby version.

require 'open-uri'
open ''

I spent a good amount of time digging into things and trying to figure out exactly what the issue was. I came to the conclusion that they either had an out of date Root CA Certificate Bundle or SSL couldn’t find it for some reason. So, I went down the path of trying to import cacert.pem from (cURL’s website).

I went down this path because I vaguely remember doing this at some point in the past to solve the Twitter API SSL Verify fail issue when they changed their certs. I ran into a huge amount of difficulty trying to get the thing imported or converted into a format that Mac OS X Keychain Access would be happy with importing. I tried pem, crt, pck12, etc. Nothing I did seemed to make a difference.

This is when I saw a post of someone talking about SSL being installed inside of RVM and I looked at the latest output from rvm requirements. I quickly noticed that it now says to install SSL via the following command:

rvm pkg install openssl

Come to find out if you have run the above command before installing your Ruby version it will be using the RVM packaged openssl instead of the system openssl. That also means that the Root CA Certificate Bundle is different, or in this case, missing completely.

After discovering this and doing a little googling I found the solution to be as simple as the following command:

curl -o ~/.rvm/usr/ssl/cert.pem

I found this solution on the following blog post Hopefully, writing another blog post on the subject and linking to this one will help it gain its ranks in google search so that other people can find it quicker.

After running the above command you should now be able to restart your irb instance and re-run the test snippet described at the beginning of this post. This time you should get output looking similar to the following:

 => #<File:/var/folders/j_/9nxyjmd10js8g1sjx446vrsm0000gn/T/open-uri20120907-36935-4i4y64> 

Just like that your SSL woes are gone.

Ruby and Rails Mountain Lion Hiccups

by Andrew De Ponte (@cyphactor)

So when Mac OS X Mountain Lion was released a few days ago I jumped on upgrading and got switched over as soon as I could. My mentality for upgrading is that I would much rather deal with the pain of upgrading in smaller chunks when needed rather than waiting. Plus, I just like to be on the latest and greatest in terms of the tools I use for my job.

Anyways, below is going to be a listing of some of the hiccups that either I or other developers on my team have run into in terms of their Ruby and Rails development environment setups.


Some of the devs on my team had Git installed via the git-osx-installer. These developers seemed to lose their Git installs when they upgraded. I was using a Homebrew install of Git and it worked just fine for me after upgrading. So be aware of what your situation is and resort to brew because it is awesome.

XCode 4.4

In order to build gems with the native exensions and just to have the basic development tools around I installed the latest XCode 4.4. Once installed I went to the preferences menu, in the download tab, and chose to install the Command Line Tools because that is really what I was looking for more than anything. I have read on other posts online that you can download the Command Line Tools alone and install just them. I personally chose to install XCode as I do use XCode and the native tools to work on iPhone/iPad app development as well.


The latest XCode now comes with clang/llvm which is a new C/C++/Objective-C compiler. The problem is that the Ruby language isn’t fully compatible with clang and llvm. Therefore, you need to install GCC 4.2 using Homebrew. GCC 4.2 is the latest version of the GCC compiler that apple provided before switching to clang/llvm. Anyways, you can install GCC 4.2 by doing the following with brew:

brew tap homebrew/dupes
brew install apple-gcc42

The above will install the apple gcc-4.2 in a side by side fashion with XCode. This means that it won’t mess up your existing XCode install like other solutions.

Once you install gcc-4.2 then you can install/reinstall your ruby version inside of RVM as needed.

Apache 2 (Web Sharing)

In the upgrade it seems that they have revamped the Sharing preference pane. In the process of this it seems that Apple has decided to remove the Web sharing component of this preference pane. Don’t worry though. Apache is still there and running. You just can’t start it and stop it from the preferences pane anymore. You can use the following commands instead.

sudo apachectl stop
sudo apachectl start
sudo apachectl restart

Note: When the upgrade happened it nuked all my /etc/apache2/users/ configs and all my other apache configs. So, if you have any custom apache configs as I did you should probably back them up before upgrading.


It seems that another thing that was changed with the upgrade to Mac OS X Mountain Lion was that they removed the X11 that I had previously installed and seemed to no longer provide it. Thats ok though because XQuartz 2.7.2 is what you want and it is available freely at Just install that bad boy and follow the on screen instructions to reboot when it is done and you should be good to go in terms of X11.


Before upgrading I had ImageMagick installed via Homebrew. After, the upgrade was finished my ImageMagick was exiting with failures about some dylib. To solve this problem I simply ran the following and I was back in running order with respect to ImageMagick:

brew upgrade imagemagick


I use Pygments to handle syntax highlighting in my jekyll sites and it seemed to not be working after the upgrade. I believe this is because it is now using Python 2.7.2. To resolve this issue I just re-installed Pygments using the following:

sudo easy_install Pygments

Archaic - Archived Chats and Dev Helper

by Andrew De Ponte (@cyphactor)

So for those of that don’t know, I lead of team of software developers. For a long time now I have noticed a number of gaps in the industry with respect to software development and team collaboration. One area that I always felt was missing some love was group chat.

Sure, there are a large number of different chat protocols and applications that implement them all. However, they generally miss an archived history that has full text searching. Beyond the group chat is prime location to distribute push notifications when Git repositories that the team is working with have changes pushed to them. Because of these two issues and number of other that I really don’t want to get into at this point I have started a new open source project called “Archaic”.

Archaic is a Rails application that provides archiving of IRC channel chats with a full text search interface as well as general developer helpers. It is composed of two pieces, an IRC Bot and the Rails application. Technically they both share the rails environment as the IRC Bot should be run with rails runner. You can checkout the project at the following:

I plan to keep the master branch functional so feel free to use the master branch. It currently has the following features.

  • IRC Chat Archiving
  • Full Text Chat Archive Searching with Context (to expand context simply click on resulting match)
  • Week number helper (when anyone in IRC channel types “weeknum” it replies with current week number)
  • Ticket number helper (when anyone in IRC channel types “#\d+” it replies with link to that ticket)

This is the initial introduction to this project and I am sure it has numerous directions that it can and will grow into. I very much welcome your thoughts, suggestions, feature requests, bug reports, testing, etc.

I believe that having a good central place of communication for a team even if they are working in the same office helps at least as a mechanism for keeping your devs notified about repo pushes close to real time.

Anyways, enjoy!

Ruby Class vs. Instance Diagram

by Andrew De Ponte (@cyphactor)

One of the many things that I have changed on my new team is the language. They were originally all PHP developers and my boss and I who have been using Ruby and Rails for years now decided to develop the new products in Ruby and Rails where fitting. Anyways, as a part of the process I have been educating (and being educated) by my engineers on Ruby and Rails as they go through the learning process. One of the topics that seems to have some confusion around it is Class vs. Instance variables with respect to classes and objects. Because this confusion I spent some time with one of the engineers to put together a quick diagram to try and help clarify what is actually happening with respect to Class vs. Instance variables and methods. You can find the diagram here.