Scenario: you have both OpenSSL 1.0 and 1.1 installed (using Brew) in your OSX system and you want to switch the current active version without removing other versions that already installed. Here is how to do it.
$ ls -al /usr/local/Cellar/openssl*
/usr/local/Cellar/openssl:
total 0
drwxr-xr-x 13 zulhilmi staff 442 Apr 21 04:31 1.0.2t
/usr/local/Cellar/openssl@1.1:
total 0
drwxr-xr-x 13 zulhilmi staff 442 Apr 21 04:01 1.1.1f
drwxr-xr-x 13 zulhilmi staff 442 Apr 24 15:41 1.1.1g
$ brew switch openssl 1.0.2t
$ brew switch openssl@1.1 1.1.1f
$ openssl version
OpenSSL 1.1.1f 31 Mar 2020
Reference:
This worked for me.
I unlinked the current version using
$brew unlink openssl@1.0
Then i linked the version i need to use using
$brew link openssl@1.1
Finally i checked the openssl version and i got
OpenSSL 1.1.1w 11 Sep 2023
It worked.