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.
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.
Updating OpenSSL to 1.1.1 on MacOS - Stack Overflow
security - How to upgrade OpenSSL in OS X? - Ask Different
Homebrew Not installing openssl
How to properly upgrading openssl with Homebrew? - Server Fault
Using brew:
brew update
brew install openssl@1.1
echo 'export PATH="$(brew --prefix)/opt/openssl@1.1/bin:$PATH"' >> ~/.bash_profile
# Verify
openssl version
# OpenSSL 1.1.1c 28 May 2019
https://stackoverflow.com/a/56639316 is a good canonical answer, but if you're looking for something simpler / one-off you may be able to get by with just this:
$ brew install openssl@1.1
$ /usr/local/opt/openssl/bin/openssl version
OpenSSL 1.1.1g 21 Apr 2020
So you could do something like this for example:
$ /usr/local/opt/openssl/bin/openssl rand -hex 32
a37d26158b53c8b43faa26ce8291fec9
If you don't have brew on your computer you can install it in one-line by following the instructions here:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
For what it's worth, I just used homebrew (http://brew.sh/):
brew update
brew install openssl
brew link --force openssl
openssl version -a
If one of the bad versions come up (1.0.1a-f), you can figure out which version of openssl you're using, this way:
which openssl
Often this is from /usr/bin. To make sure you get the updated version, drop a symlink into /usr/local/bin to point to the updated openssl, like this:
ln -s /usr/local/Cellar/openssl/1.0.1g/bin/openssl /usr/local/bin/openssl
As an alternative to that final step, some people replace the openssl in /usr/bin with a symlink to /usr/local/Cellar/openssl/1.0.1g/bin/openssl (or whatever your version is):
mv /usr/bin/openssl /usr/bin/openssl_OLD
ln -s /usr/local/Cellar/openssl/1.0.1g/bin/openssl /usr/bin/openssl
But this is known to cause problems with some more recent versions of OSX. Better to just insert a new symlink into /usr/local/bin, which should take precedence on your path over /usr/bin.
Or for those who are using mac ports, and are not worried about keeping the version
sudo port upgrade openssl
simples :-)
I'm sure this is a stupid quetsion. But I just recived my new M1 Mac Pro and am working through setting up the basics. I am attempting to install openssl through homebrew, and it keeps not finding the package even though I'm pulling the command right from their website.
Here is the output of my terminal.
theworkinghamster ~ % brew install openssl
fatal: Could not resolve HEAD to a revision
Warning: No available formula with the name "openssl".
Execute following commands:
brew update
brew install openssl
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
You will have the latest version of openssl installed and accessible from cli (command line/terminal). Since the third command will add export path to .bash_profile, the newly installed version of openssl will be accessible across system restarts.
Only
export PATH=$(brew --prefix openssl)/bin:$PATH in ~/.bash_profile
has worked for me! Thank you mipadi.