Update OpenSSL on OS X with Homebrew
Solution 1
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.
Solution 2
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.
Solution 3
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.
Solution 4
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".
Solution 5
To answer your question regarding updating openssl I followed these steps to successfully update the version found on my Mac to the newest openssl version 1.0.1e.
I followed the steps found here: http://foodpicky.com/?p=99
When you reach the steps for terminal commands make and make install be sure to use sudo make and sudo make install (I had to go through the step-by-step twice because I did it without sudo and it did not update).
Hope this helps
Joachim
Updated on August 31, 2021Comments
-
Joachim over 2 years
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.
-
netwire almost 11 yearsThanks, that worked. I reference this doc on how to add to $PATH: hathaway.cc/2008/06/…
-
Yavor Ivanov almost 11 yearsThanks! Killed couple of hours on this issue.
-
Felipe about 10 yearsIn my case I put this on my ~/.profile PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/opt/X11/bin:/usr/local/MacGPG2/bin:/usr/bin:/bin:/usr/sbin
-
SapphireSun about 10 yearsFYI as of today, 1.0.1e (specifically 1.0.1a-f) is known to have a serious security vulnerability. Future readers, make sure you upgrade to at least 1.0.1g heartbleed.com
-
quantumpotato about 10 yearsThe old version is still showing for me: stackoverflow.com/questions/22974590/…
-
jww about 8 yearsMinus One: "... be sure to use sudo make..." - You don't make with privileges. You just
make
and and thensudo make install
if needed. You also cited a horrible reference. It replaces Apple's OpenSSL 0.9.8 in/usr
with the updated 1.0.x. That's a really bad thing to do because there's no binary compatibility. -
Peyman Mohamadpour almost 8 yearsI have installed
1.0.2h_1
, but I am exactly on the same situation, butopenssl version -a
still gives meOpenSSL 0.9.8zg 14 July 2015
. Any suggestions? -
biplob almost 8 yearsExactly same thing happened to me. It's fixec by @Marc Smith answer
-
Timo over 7 yearsThis one doesn't work because
brew link --force openssl Warning: Refusing to link: openssl Linking keg-only openssl means you may end up linking against the insecure, deprecated system OpenSSL while using the headers from Homebrew's openssl. Instead, pass the full include/library paths to your compiler e.g.: -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
-
Tuhina Singh over 7 years@TimoLehto Were you able to resolve this issue? Am facing same issue and cant seem to find a solution anywhere
-
Timo over 7 years@TuhinaSingh Sorry no luck, other than "following the instructions" and not linking the system library, but instead linking on demand with flags whenever I need it for compile or just calling the brew version directly i.e.
/usr/local/Cellar/openssl/1.0.2h_1/bin/openssl
-
Wade Williams over 7 yearsThe question was about Homebrew... macports is not homebrew... The OP states they prefer not to use mac ports.
-
Morteza Sepehri Niya over 7 years@WadeWilliams mac in new version dose not let you update
openssl
usingHomebrew
, I mean you can install or update it usingHomebrew
but you can not prioritize it. So, instead of updating it usingHomebrew
you can update it usingmacports
and prioritize it. -
brunodd over 7 years@TimoLehto No idea if this is 'good practice' or even safe to do, but you could always create a link from /usr/local/bin to /usr/local/opt/openssl/bin/openssl. This can be done using the following command:
ln -s /usr/local/opt/openssl/bin/openssl /usr/local/bin/openssl
. To be clear: I can't promise you that this is a safe or correct way of proceeding. -
ekkis about 7 yearsmore info on this issue: stackoverflow.com/questions/38670295/…
-
rogerdpack over 6 yearsIt just says
Refusing to link: openssl