Set Openssl 1.1.1 as a default version

Viewed 1866

I have macOS BigSur 11.6. When I run openssl version I get

LibreSSL 2.8.3

What I want is to get this output:

OpenSSL 1.1.1l  24 Aug 2021

In the /usr/local/opt/ there are folders: openssl, openssl@3, openssl@1.1.

I ran these commands:

brew install openssl
brew reinstall openssl@3
sudo ln -sfn /usr/local/Cellar/openssl@1.1 /usr/local/opt/openssl

I placed the line export PATH="/usr/local/opt/openssl@1.1/bin:$PATH" in files ~/.profile, ~/.bash_profile, ~/bashrc.

But nothing helps. How can I make the default openssl version 1.1?

Plese, don't offer commands as in this or this questions. These commands don't change anything: as soon as I open a new session I get the same LibreSSL 2.8.3 instead of opessl 1.1.1l

export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
source ~/.profile
source ~/.bash_profile
source ~/.bashrc

UPD 1

  • type -a openssl shows:
openssl is /usr/bin/openssl
  • echo $PATH shows:
/usr/local/opt/libressl/bin:/usr/local/opt/python@3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

UPD 2

Just made unset PATH, set in files ~/.profile, ~/.bash_profile, ~/bashrc the same line export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/openssl@1.1/bin:$PATH" and ran this line in bash. Anyway there is the same output for openssl version: LibreSSL 2.8.3.

  • this bash --norc -c 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin; set -x; source ~/.bash_profile' shows:
+ source /Users/sgalich/.bash_profile
++ export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/openssl@1.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
++ PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/openssl@1.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
++ export LDFLAGS=-L/usr/local/opt/openssl@1.1/lib
++ LDFLAGS=-L/usr/local/opt/openssl@1.1/lib
++ export CPPFLAGS=-I/usr/local/opt/openssl@1.1/include
++ CPPFLAGS=-I/usr/local/opt/openssl@1.1/include
++ export CPATH=/usr/local/opt/openssl@1.1/include
++ CPATH=/usr/local/opt/openssl@1.1/include
++ export LIBRARY_PATH=/usr/local/opt/openssl@1.1/lib
++ LIBRARY_PATH=/usr/local/opt/openssl@1.1/lib
++ export DYLD_LIBRARY_PATH=/usr/local/opt/openssl@1.1/lib
++ DYLD_LIBRARY_PATH=/usr/local/opt/openssl@1.1/lib
++ export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/opt/openssl@1.1/lib
++ DYLD_FALLBACK_LIBRARY_PATH=/usr/local/opt/openssl@1.1/lib
2 Answers

So the issue was in my PATH variable. My problem was solved after adding this line in the ~/.bash_profile:

PATH="/usr/local/opt/openssl@1.1/bin:$PATH"

Thanks @Gordon Davisson for the answer!

On MacOS Monterey (with M1 chip) the paths differed.

I added the following to ~/.zshrc

export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"
Related