When seeing the following error:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
First, check your RubyGems version is higher than 1.8.24:
gem update --system
If that doesn't solve the problem, consider reinstalling Ruby with a new version of OpenSSL:
rbenv uninstall 1.9.3-p327
brew install readline
brew install openssl
CONFIGURE_OPTS="--disable-install-doc --with-openssl-dir=`brew --prefix openssl` --with-readline-dir=`brew --prefix readline`" rbenv install 1.9.3-p327