How to update Openssl on MacOS

How to update Openssl on MacOS

Avoid issues that come with unsupported OpenSSL versions for a better developer experience on Mac devices.

Does your MacBook have an unsupported version of OpenSSL? In this small article, I’ll show you how you can install the supported version in simple steps in the terminal.

  1. Verify the installed version

  2. Uninstall the old version

  3. Install the new version

  4. Update the path

  5. Reload the shell

  6. Verify

To uninstall and install OpenSSL, you will need to use the terminal app. And you need administrator privileges in order to be successful. So open the terminal app and follow the steps below.

  1. Verify the installed version

$ openssl version
  1. Uninstall unsupported version

$ brew uninstall openssl@1.1

Optionally, you might have to run an extra command in order to remove remnants or uninstall the unwanted OpenSSL version completely.

$ rm -rf /opt/homebrew/etc/openssl@1.0
  1. Install the current supported version

$ brew install openssl@3
  1. Update your PATH to use the new version

$ echo 'export PATH="/usr/local/opt/openssl@3/bin:$PATH"' >> ~/.zshrc
# Or if using bash:
# $echo 'export PATH="/usr/local/opt/openssl@3/bin:$PATH"' >> ~/.bashrc
# Update compiler flags for building software that uses OpenSSL
$ export LDFLAGS="-L/usr/local/opt/openssl@3/lib"
$ export CPPFLAGS="-I/usr/local/opt/openssl@3/include"
$ export PKG_CONFIG_PATH="/usr/local/opt/openssl@3/lib/pkgconfig"
  1. Reload your shell configuration

$ source ~/.zshrc
# or source ~/.bashrc if using bash
  1. Verify the installation

$ openssl version

If all is well, you will see something like this.