28

In my mac version 10.15.5, openssl is still pointing to LibreSSL 2.8.3. I have used the below commands, but no luck

homebrew install libressl

After installation when I ran the version command it is still showing LibreSSL 2.8.3 Also below command is throwing error -

brew link --force openssl                                                
Warning: Refusing to link macOS provided/shadowed software: [email protected]
If you need to have [email protected] first in your PATH run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
Sudipta Deb
  • 465
  • 1
  • 4
  • 10

3 Answers3

23

You may already have this working. To test run: which openssl

Further, running this will advise which version is the default: openssl version

To change to the homebrew version you need to add it into the path before the default. To do this, edit the startup script for your shell (which it seems in your case is zsh). So in your case edit ~/.zshrc with your favorite text editor or something like: nano ~/.zshrc

(for the default bash shell, use nano ~/.bashrc)

Insert a command to add the path to the brew installed OpenSSL using this line, preferably somewhere near the top of the file:

export PATH="/usr/local/opt/[email protected]/bin:$PATH"

(At the time of writing the most recent version of OpenSSL has moved onto 1.1.1, so it may need to look like this now export PATH="/usr/local/opt/[email protected]/bin:$PATH")

Then "reload" the zsh startup script with this command:

source ~/.zshrc

You should now be seeing openssl 1.1 (no longer libressl) when running which openssl or openssl version

Saikat
  • 14,222
  • 20
  • 104
  • 125
Roy Verrips
  • 371
  • 1
  • 3
12

For users with Apple M1 silicon OpenSSL installed by brew has a different location. You should add a line export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH" at ~/.zshrc file

4

So for me, openssl version used to be LibreSSL 2.8.3. Doing export PATH="/usr/local/opt/[email protected]/bin:$PATH" only got it to show OpenSSL 1.1.1i in the terminal, and also which openssl gives me the right command, but it still doesn't work.

So then adding the line export PATH="/usr/local/opt/[email protected]/bin:$PATH" inside ~/.profile worked.

Not ~/.bash_profile if you are using bash, or ~/.zshrc, or /etc/paths.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Onion
  • 85
  • 1
  • 9