I tried to install cocoapods (http://cocoapods.org/) on my OSX Mountain Lion.
moshe-mbp:~ moshem$ gem install cocoapods
ERROR: Could not find a valid gem
You can first install a newer openssl, as Mike Slutsky described. To check your openssl version:
$ openssl version
Get a more recent one here: http://www.openssl.org/source/ Then configure and install it:
$ cd openssl-1.0.1f_src/
$ ./Configure --prefix=/Users/me/bin/openssl-1.0.1f_bin darwin64-x86_64-cc
$ make install
Now configure ruby with this openssl:
$ cd ruby-2.1.0_src/
$ ./configure --with-openssl-dir=/Users/me/bin/openssl-1.0.1f_bin --prefix=/Users/me/bin/ruby-2.1.0_bin
Note: the new openssl does not need to be on you $PATH. This worked for me with ruby 2.0 and 2.1. Good luck (-: