First execute the following commands to install openssl on OSX using Homebrew:
brew update
brew install openssl
brew link --force openssl
openssl version -a
If the new version has not been applied successfully, create a symlink to solve the problem. To do that, we need to figure out the location of openssl using
which openssl
(It's mostly at /usr/bin/openssl)
Next, replace with a symlink to the location of the new version (mine's /usr/local/Cellar/openssl/1.0.1h/bin/openssl)
sudo rm /usr/bin/openssl
sudo ln -s /usr/local/Cellar/openssl/1.0.1h/bin/openssl /usr/local/bin