Update OpenSSL on OS X with Homebrew
I'm using MacOS X 10.7.5 and I need a newer OpenSSL version due to handshake failures. There are several tutorials on the internet and I tried the following:
brew install openssl
brew link openssl --force
Nevertheless, it does not work:
openssl version
OpenSSL 0.9.8r 8 Feb 2011
brew unlink openssl && brew link openssl --force
Unlinking /usr/local/Cellar/openssl/1.0.1e... 1139 links removed
Linking /usr/local/Cellar/openssl/1.0.1e... 1139 symlinks created
The SVN issue is not resolved either. Any ideas? I would rather not try the MacPorts way because it may interfere with Homebrew.
If you're using Homebrew /usr/local/bin should already be at the front of $PATH
or at least come before /usr/bin. If you now run brew link --force openssl
in your terminal window, open a new one and run which openssl
in it. It should now show openssl
under /usr/local/bin.
installed openssl on mac with brew but nothing found on /usr/local/bin
where other brew installed bins are located. Found my fresh openssl here:
/usr/local/opt/openssl/bin/openssl
Run it like this:
/usr/local/opt/openssl/bin/openssl version
I don't want to update OS X openssl, while some OS stuff or other 3rd party apps may have dependency on older version.
I also don't mind longer path than just openssl
Writing this here for all the Googlers who are looking for location of openssl installed by brew.
In a terminal, run:
export PATH=/usr/local/bin:$PATH
brew link --force openssl
You may have to unlink openssl first if you get a warning: brew unlink openssl
This ensures we're linking the correct openssl for this situation. (and doesn't mess with .profile)
Hat tip to @Olaf's answer and @Felipe's comment. Some people - such as myself - may have some pretty messed up PATH vars.
I had this issue and found that the installation of the newer openssl
did actually work, but my PATH
was setup incorrectly for it -- my $PATH
had the ports path placed before my brew path so it always found the older version of openssl
.
The fix for me was to put the path to brew
(/usr/local/bin) at the front of my $PATH
.
To find out where you're loading openssl
from, run which openssl
and note the output. It will be the location of the version your system is using when you run openssl
. Its going to be somewhere other than the brew
path of "/usr/local/bin". Change your $PATH
, close that terminal tab and open a new one, and run which openssl
. You should see a different path now, probably under /usr/local/bin. Now run openssl version
and you should see the new version you installed "OpenSSL 1.0.1e 11 Feb 2013".