27

For building one particular library I need openssl library version 1.0.2m with devel package. I am working on macOS. Using brew install openssl installs latest version 1.1.1d.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Leon Dobnik
  • 333
  • 1
  • 4
  • 10

8 Answers8

40

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 <brew-test-bot@googlegroups.com>
Date:   Thu Nov 2 17:20:33 2017 +0000

    openssl: update 1.0.2m bottle.
Reinier Torenbeek
  • 16,669
  • 7
  • 46
  • 69
  • 1
    It took me forever to reach a working solution - thank you so much for this! – reesaspieces Sep 14 '20 at 06:50
  • Thank you so much! I wasted two days on this issue :( – SlurpGoose Dec 16 '20 at 19:54
  • Using the rbenv/tap/openssl@1.0 from https://stackoverflow.com/a/61368160/2551154 is a better solution because it installs as openssl@1.0 and is unlikely to conflict with other packages. Checking out an older version of openssl.rb is likely cause conflicts. – Firefishy Mar 29 '21 at 01:20
29

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/openssl@1.0 rvm reinstall 1.9.3-p551 --with-openssl-dir='/usr/local/opt/openssl@1.0' gem update --system

Akhil Latta
  • 528
  • 5
  • 13
13

Instead of downloading the specific version of Formula/openssl.rb you can just use the raw reference to the file with the specific commit SHA as mentioned here.

So for the last update to version 1.0.2t the SHA is 8b9d6d688f483a0f33fcfc93d433de501b9c3513

commit 8b9d6d688f483a0f33fcfc93d433de501b9c3513
Author: BrewTestBot <homebrew-test-bot@lists.sfconservancy.org>
Date:   Sat Sep 28 19:38:49 2019 +0000

    openssl: update 1.0.2t bottle.

So I would execute the following command to install 1.0.2t.

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8b9d6d688f483a0f33fcfc93d433de501b9c3513/Formula/openssl.rb
  • 18
    For me, the command resulted in an error: `"Calling Installation of openssl from a GitHub commit URL is disabled! Use 'brew extract openssl' to stable tap on GitHub instead."` :/ – reesaspieces Sep 14 '20 at 06:51
8

1- Download the file:

wget https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

2 - Run brew with the file downloaded:

brew install openssl.rb

  • 1
    This worked! I had to first install wget via "brew install wget", which updated a whole lot of packages along the way. I was then able to "brew switch openssl 1.0.2t" – Eric Vautier Oct 02 '20 at 09:54
  • 1
    Additional comment (couldn't edit above as over 5mn). For PHP5.6 (unfortunately still needed on an old project, don't ask), I also had to "wget https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb" to get icu4c 64.2 and switch to it with "brew switch icu4c 64.2". – Eric Vautier Oct 02 '20 at 10:11
8

Other solutions won't work because you will get this error "Calling Installation of openssl from a GitHub commit URL is disabled! Use 'brew extract openssl' to stable tap on GitHub instead." the following steps will fix it:

  1. First go to the local installation of homebrew
cd /usr/local/Homebrew/
  1. Homebrew 2.5 remove the option to install formulas directly from git repos so we need to checkout an older version
git checkout 2.3.0
  1. Install openssl latest 1.0.x version
HOMEBREW_NO_AUTO_UPDATE=1 brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
  1. Go back to current version of homebrew
git co -
  1. Tell brew to use the old version of openssl this way you can chose wich version to use if you have both intalled
brew switch openssl 1.0.2t
Juan Gomez
  • 109
  • 1
  • 3
  • `co` is a common alias for `checkout`. If you haven't set this up please run `git checkout -o` to switch to the current version of homebrew. – romeo14 Oct 18 '20 at 08:48
  • Better solution is just to use: brew install rbenv/tap/openssl@1.0 – Firefishy Mar 29 '21 at 01:24
2

Update - I think I've been getting downvotes because I've simply posted a link without the solution. So here's the solution:

  • Download this formula for OpenSSL V1.0 (It is patched to work with the arm64 processor)
  • Install it brew install openssl@1.0.rb
  • Add this version to the beginning of your PATH. Note: Make sure that RVM is the last PATH variable change in your shell config file (.zshrc / .bashrc)
    echo 'export PATH="/opt/homebrew/opt/openssl@1.0/bin:$PATH"' >> ~/.zshrc
  • Export some required environment variables
 export LDFLAGS="-L/opt/homebrew/opt/openssl@1.0/lib"
 export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.0/include"
 export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.0/lib/pkgconfig"
  • Reload your shell config source ~/.zshrc
  • Verify your openssl version
> openssl version
OpenSSL 1.0.2u  20 Dec 2019
  • Disable RVM autolibs rvm autolibs disable
  • Export some env variables to avoid compilation errors
export RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC
export optflags="-Wno-error=implicit-function-declaration"
  • Install Ruby
rvm install 2.3.0 --with-openssl-dir=/opt/homebrew/opt/openssl@1.0

Ref

3minus1
  • 149
  • 6
-3

Maybe it's not a perfect idea, but it solved my problem (libssl.1.0.0.dylib image not found):

sudo ln -s /usr/lib/libssl.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
sudo ln -s /usr/lib/libcrypto.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib

Hope it works for you!

See this reply

Minglei Lee
  • 27
  • 1
  • 5
  • Don't do this! Using symlinks to system libraries is dangerous. Also new releases of MacOS use LibreSSL instead of OpenSSL. Use: brew install rbenv/tap/openssl@1.0 – Firefishy Mar 29 '21 at 01:23
-3

Here is the linux-brew formula for openssl@1.0.2

brew install https://raw.githubusercontent.com/Homebrew/linuxbrew-core/20ab55b304597c6c47149dc0e50bd5f7ea45b678/Formula/openssl.rb
Dharman
  • 30,962
  • 25
  • 85
  • 135
bird
  • 1