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.
Verify the installed version
Uninstall the old version
Install the new version
Update the path
Reload the shell
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.
Verify the installed version
$ openssl version
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
Install the current supported version
$ brew install openssl@3
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"
Reload your shell configuration
$ source ~/.zshrc
# or source ~/.bashrc if using bash
Verify the installation
$ openssl version
If all is well, you will see something like this.