This has changed with the latest verison of brew on Big Sur (11.5.1) on a Macbook M1 (just for completeness):

export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"
Answer from MuseumPiece on Stack Overflow
🌐
Medium
medium.com › @timmykko › using-openssl-library-with-macos-sierra-7807cfd47892
Using the OpenSSL library with macOS Sierra | by Timothy Ko | Medium
January 14, 2018 - ... $ brew link --force openssl Warning: Refusing to link: openssl Linking keg-only openssl means you may end up linking against the insecure, deprecated system OpenSSL while using the headers from Homebrew's openssl.
🌐
Stack Exchange
apple.stackexchange.com › questions › 220140 › where-to-find-openssl-devel-package-cant-seem-to-find-it-in-brew
macos - Where to find OpenSSL devel package - can't seem to find it in Brew - Ask Different
For instance, openssl is a runtime and openssl-devel is a development package on those package managers. However, packages on Homebrew aren't separated in this manner but just contain both. This is why just installing openssl is fine on Homebrew. ... Equal, I am not sure that just installing openssl is going to help as Zulu has said that the package isn't available within brew so the issue is more complex.
🌐
Deepan Seeralan
deepanseeralan.com › tech › openssl-dev-on-macOS
Working with openssl in macOS - Deepan Seeralan
December 18, 2021 - If you need to have openssl@1.1 ... days), 787,233 (365 days) build-error: 1,183 (30 days) ~ % brew installs the requested version of openssl into /usr/local/Cellar/ and creates a symlink at /usr/local/opt/openssl....
🌐
Travis CI Community
travis-ci.community › environments
Where does Brew install OpenSSL on OS X? - Environments - Travis CI Community
February 27, 2020 - Hi Everyone, Please forgive my ignorance. Search is producing irrelevant noise for the question… We are trying to enable OS X builds using Travis for Unbound. The OS X test is failing due to OpenSSL. We added the following to the YML file, but Brew states OpenSSL is already installed. before_install: - | if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update brew install openssl fi The actual configure failure is: checking for SSL... configure: error: Cannot find the S...
🌐
GitHub
gist.github.com › roolo › 2146224
brew install openssl - Gist - GitHub
brew install openssl. GitHub Gist: instantly share code, notes, and snippets.
🌐
GitHub
github.com › neutrinolabs › xrdp › issues › 340
OS X: configure: error: please install libssl-dev or openssl-devel · Issue #340 · neutrinolabs/xrdp
March 4, 2016 - I'm trying to build it on OS X. I tried brew install openssl-dev or brew install libssl-devel. No recipes found. I've built and installed latest openssl and I've run configure again but it still sa...
Author   neutrinolabs
Find elsewhere
🌐
GitHub
gist.github.com › aklap › e885721ef15c8668ed0a1dd64d2ea1a7
Resolving missing link to libcrypto/openssl on OSX · GitHub
I got another problem when I uninstall 1.1 after install 1.0. ruby-2.6.5/lib/ruby/2.6.0/x86_64-darwin17/digest/sha1.bundle, 9): Library not loaded: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib ... at first, cp the /usr/local/opt/openssl to /usr/local/Cellar/openssl/1.0.2t then, uninstall 1.0 and reinstall 1.1. ... brew uninstall --ignore-dependencies openssl brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/30fd2b68feb458656c2da2b91e577960b11c42f4/Formula/openssl.rb
🌐
FixMyCert
fixmycert.com › guides › openssl-installation
Install OpenSSL: Windows, Linux, macOS, Alpine
# Check the default openssl openssl version # Likely output: LibreSSL 3.3.6 # Check if Homebrew OpenSSL is installed brew list openssl 2>/dev/null && echo "Homebrew OpenSSL installed"
🌐
GitHub
github.com › openssl › openssl › issues › 20372
macOS 13.2.1 M2 processor brew install openssl error · Issue #20372 · openssl/openssl
February 24, 2023 - ==> Fetching openssl@1.1 Warning: Building openssl@1.1 from source as the bottle needs: - HOMEBREW_CELLAR: /opt/homebrew/Cellar (yours is /Users/someuser/homebrew/Cellar) - HOMEBREW_PREFIX: /opt/homebrew (yours is /Users/someuser/homebrew) ==> Downloading https://www.openssl.org/source/openssl-1.1.1t.tar.gz Already downloaded: /Users/someuser/Library/Caches/Homebrew/downloads/ec3feb171aa63b32c30a6e7423e78f743f92d1ef984b66b0ea548d08220c0ce6--openssl-1.1.1t.tar.gz ==> perl ./Configure --prefix=/Users/someuser/homebrew/Cellar/openssl@1.1/1.1.1t --openssldir=/Users/someuser/homebrew/etc/openssl@1.
Author   openssl
🌐
Medium
yasar-yy.medium.com › installing-openssl-library-on-macos-catalina-6777a2e238a6
Installing OpenSSL library on macOS Catalina | by Yaşar Yücel Yeşilbağ | Medium
September 18, 2020 - We have to find library path of OpenSSL and add it to DYLD_LIBRARY_PATH environment variable. For this purpose, run “brew info openssl” command again. ... The path in the red rectangle at above screenshot is the path where OpenSSL is installed.
Top answer
1 of 8
41

Since OpenSSL 1.0.2 is end of lifed by the end of 2019, it is no longer available via Homebrew. This is mentioned in the Homebrew 2.2.0 announcement.

It is fairly straightforward to build and install OpenSSL 1.0.2 yourself from source. You can download your required version from the Old 1.0.2 Releases page and follow the instructions found in INSTALL.


It may be possible as well to recover an older formula and install from that, but I can not guarantee how well that works. The following steps did complete the installation process:

$ git clone https://github.com/Homebrew/homebrew-core.git
$ cd homebrew-core
$ git checkout 75b57384 Formula/openssl.rb
$ brew install Formula/openssl.rb

For me, this showed:

Warning: openssl 1.1.1d is available and more recent than version 1.0.2m.
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2m.high_sierra.bottle.tar.gz

and went on happily after that. A quick try at the end gives some confidence that it worked out well:

$ /usr/local/opt/openssl/bin/openssl version
OpenSSL 1.0.2m  2 Nov 2017

If you prefer not to use git directly, you can also try downloading that version of openssl.rb from gitHub.com and run brew install on it.


If you wonder where that commit hash came from, I happened to know that the formula used to be called -- surprise -- openssl.rb (but using git to query for removed files would have worked as well). Therefore, I inspected the history for Formula/openssl.rb and found:

$ git log -- Formula/openssl.rb
...
commit 75b573845a17aaf3f7c84dc58e97cf5fe39a502b
Author: BrewTestBot <[email protected]>
Date:   Thu Nov 2 17:20:33 2017 +0000

    openssl: update 1.0.2m bottle.
2 of 8
31

Recently I was struggling due to the recent update in openssl version from 1.0 to 1.1 and wanted to revert it back to older version. No other solution except the one given below worked for me:

brew install rbenv/tap/[email protected] rvm reinstall 1.9.3-p551 --with-openssl-dir='/usr/local/opt/[email protected]' gem update --system

🌐
Homebrew
formulae.brew.sh › formula › openssl@3
Homebrew Formulae: openssl@3
brew install openssl@3 · Also known as: openssl, openssl@3.6 · Cryptography and SSL/TLS Toolkit · https://openssl-library.org · License: Apache-2.0 · Development: Pull requests · Formula JSON API: /api/formula/openssl@3.json · Formula ...
🌐
GitHub
gist.github.com › byronmansfield › 97d74d8b0d1ea28b48536020dbd6d53e
Install OpenSSL from source Mac OS X · GitHub
Here is what worked for me: sudo make install MANDIR=/usr/local/openssl/share/man MANSUFFIX=ssl That completed fine. ... I am getting below error , need help on this. /Library/Developer/CommandLineTools/usr/bin/make depend && /Library/Devel...
Top answer
1 of 3
3

IMO the best way to install openssl on MacOS is to use Homebrew. This will not only install openssl, but will also allow it to be upgraded in the future.

brew install openssl

If you want to make the Homebrew version the default (rather than the LibreSSL that comes with MacOS), you will also need put the Hombrew-installed openssl on your path ahead of the MacOS version. While it is possible to accomplish this by putting /opt/homebrew/bin on your PATH ahead of /usr/bin, I strongly discourage this, because it makes you vulnerable to unintentionally installing a malicious Homebrew package named something like ls that overrides your default ls with malicious code. Instead, my personal preference is to have a user-level directory where I maintain a small set of binaries that override the defaults.

# Create a user-level bin directory, if it doesn't already exist.
mkdir -p ~/bin

# Create a symlink to the Homebrew openssl, if such a symlink does not already exist
ln -fs /opt/homebrew/bin/openssl ~/bin/openssl

Then, put ~/bin on your PATH, ahead of /usr/bin. This part depends on which shell you are using. For bash, you can add this to your ~/.bash_profile.

# User-level binaries, manually added
PATH="${HOME}/bin:${PATH}"
2 of 3
2

The first option is the simplest one: do nothing. macOS has shipped with OpenSSL preinstalled since 2000.

You can download a binary distribution of OpenSSL. The OpenSSL project does not itself publish binary releases, but they maintain a list of third-party resources that publish OpenSSL binaries.

You can install it using MacPorts.

You can install it using Homebrew.

You can compile it yourself. You already downloaded the source code, so all you need is to follow the instructions in the INSTALL.md file you are showing in your screenshot. I assume that, since you chose to use an inofficial development version, you may run into some bugs.

🌐
GraalVM
graalvm.org › 22.0 › reference-manual › ruby › Installinglibssl
Installing libssl
sudo dnf install openssl-devel · sudo apt-get install libssl-dev · On macOS the system version is too old. We recommend installing libssl via Homebrew. brew install openssl · MacPorts should also work but is not actively tested.