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
python - How to update OpenSSL on mac? - Stack Overflow
Updating OpenSSL on Mac System version 10… - Apple Community
macos - How to install latest version of openssl Mac OS X El Capitan - Stack Overflow
Videos
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 :-)
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)"
I think this is a multi-part issue with the versions of Python you are using and your $PATH variable.
First check where you're looking for Python by using this command in the terminal:
which python
It should output something like this: /usr/local/bin/python
Then check for the path that you have setup.
echo $PATH
Likely you're seeing something like:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/username/anaconda/bin:/usr/bin:/bin:/usr/sbin:/sbin
The issue is probably that the version of python tied to your default when you enter python in your terminal is not one that has the modern version of openssl.
In other words:
openssl version -a
Is checking for openssl somewhere different than
python -c "import ssl; print ssl.OPENSSL_VERSION"
To fix this, you might try editing your $PATH variable.
I suggest doing this by editing something like your ~/.bash_profile file. You can add something like this to specify a different Python binary to use:
export PATH="/usr/local/bin:$PATH"
Plop this on the end of your .bash_profile file and then whenever you're using bash it should look for Python in the /usr/local/bin directory before looking elsewhere. Keep in mind that this might also affect places that other programs look for Python (or other binaries).
@fernando's answer had the right theory but his recommendation for a next step didn't work for me, because /usr/local/bin was already first in my $PATH. Here's how I fixed mine:
In the response for brew info python I saw:
==> Caveats
This formula installs a python2 executable to /usr/local/bin.
If you wish to have this formula's python executable in your PATH then add the following to ~/.bash_profile:
export PATH="/usr/local/opt/python/libexec/bin:$PATH"
I added that last line to my ~/.bash_profile, opened a new terminal window, and it worked.
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.
IMO the best way to install openssl on MacOS is to use Homebrew. This will not only install openssl, but will also allow it to be upgraded in the future.
brew install openssl
If you want to make the Homebrew version the default (rather than the LibreSSL that comes with MacOS), you will also need put the Hombrew-installed openssl on your path ahead of the MacOS version. While it is possible to accomplish this by putting /opt/homebrew/bin on your PATH ahead of /usr/bin, I strongly discourage this, because it makes you vulnerable to unintentionally installing a malicious Homebrew package named something like ls that overrides your default ls with malicious code. Instead, my personal preference is to have a user-level directory where I maintain a small set of binaries that override the defaults.
# Create a user-level bin directory, if it doesn't already exist.
mkdir -p ~/bin
# Create a symlink to the Homebrew openssl, if such a symlink does not already exist
ln -fs /opt/homebrew/bin/openssl ~/bin/openssl
Then, put ~/bin on your PATH, ahead of /usr/bin. This part depends on which shell you are using. For bash, you can add this to your ~/.bash_profile.
# User-level binaries, manually added
PATH="${HOME}/bin:${PATH}"
The first option is the simplest one: do nothing. macOS has shipped with OpenSSL preinstalled since 2000.
You can download a binary distribution of OpenSSL. The OpenSSL project does not itself publish binary releases, but they maintain a list of third-party resources that publish OpenSSL binaries.
You can install it using MacPorts.
You can install it using Homebrew.
You can compile it yourself. You already downloaded the source code, so all you need is to follow the instructions in the INSTALL.md file you are showing in your screenshot. I assume that, since you chose to use an inofficial development version, you may run into some bugs.