gem install and ssl errors

fabian@heartofgold $ gem install somecoolgem
ERROR:  Could not find a valid gem 'somecoolgem' (>= 0), here is why:
          Unable to download data from http://gems.rubyforge.org/ -
          SSL_connect returned=1 errno=0 state=SSLv3 read server
          certificate B: certificate verify failed
          (https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz)

Sounds common? There is a really easy solution in 3 steps:

  1. $ brew install curl-ca-bundle (if you don’t have Homebrew installed, then there is another surprising step..)
  2. $ export SSL_CERT_FILE=/usr/local/opt/curl-ca-bundle/share/ca-bundle.crt
  3. put the last one somewhere inside your .zshrc/.bashrc