7

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
sgalich
  • 178
  • 3
  • 12
  • What shell are you using, bash or zsh (or something else)? Running `ps $$` should show you what it is. – Gordon Davisson Oct 08 '21 at 00:06
  • hey @GordonDavisson, I'm using bash – sgalich Oct 08 '21 at 00:13
  • Then I'd expect it to work. What do `type -a openssl` and `echo "$PATH"` show? – Gordon Davisson Oct 08 '21 at 00:34
  • @GordonDavisson, added UPD 1 with the outputs. – sgalich Oct 08 '21 at 03:23
  • So `/usr/local/opt/openssl@1.1/bin` is *not* in your `PATH`; the question is, why not? You put a command to add it in ~/.bash_profile (which is the one that gets run for initial interactive bash shells). Check your ~/.bash_profile to see if there's anything that would exit it before it hits the `PATH=...` command you added, or anything that'd remove/replace it in the `PATH` after that. It may help to get an execution trace with `bash --norc -c 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin; set -x; source ~/.bash_profile'` and look for lines like `+ PATH=something`. – Gordon Davisson Oct 08 '21 at 03:41
  • @GordonDavisson, updated the question with the output – sgalich Oct 08 '21 at 18:07
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/237971/discussion-between-gordon-davisson-and-sgalich). – Gordon Davisson Oct 08 '21 at 19:31
  • having the same issue in macm1 oct.15,2022 – KD.S.T. Oct 15 '22 at 05:38

2 Answers2

3

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"
0

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!

sgalich
  • 178
  • 3
  • 12