【macOS, Home Brew v2.2以上】openssl1.0.2をインストールする方法
Home Brew2.2.0でopenssl1.0.2が削除されました。brew install openssl
では入りません。
openssl1.0.2は2019年12月にはサポートが終了、利用は非推奨となっております。
とは言え!!
とは言えRuby2.3.7以下はopenssl1.1との互換性がなく、バージョン上げられない環境にいる方は利用せざるおえません。
そんな何らかの理由により利用せざるおえない、そしてうっかりuninstallしてしまった方のために、悪戦苦闘した記録を残します。
環境
Homebrew 2.2.1 Homebrew/homebrew-core (git revision 7cbbe; last commit 2019-12-18) Homebrew/homebrew-cask (git revision 1954a; last commit 2019-12-19) rbenv 1.1.2
インストール方法
ターミナルで下記を叩きます。
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8b9d6d688f483a0f33fcfc93d433de501b9c3513/Formula/openssl.rb
おそらく、brewのgithubの古いcommitからopenssl1.0.2tを引っ張ってきています。
https://raw.githubusercontent.com/Homebrew/homebrew-core/8b9d6d688f483a0f33fcfc93d433de501b9c3513/Formula/openssl.rb
をブラウザで見ると、下記のコメントを見つけました。
This formula tracks 1.0.2 branch of OpenSSL, not the 1.1.0 branch. Due to significant breaking API changes in 1.1.0 other formulae will be migrated across slowly, so core will ship
openssl
&openssl@1.1
for foreseeable.
この式は、1.1.0ブランチではなく、OpenSSLの1.0.2ブランチを追跡します。のため 1.1.0での重大な重大なAPIの変更が他の式に移行されます
ゆっくりと渡るので、コアは予見できるようにopenssl
とopenssl @ 1.1
を出荷します。
なるほど?
走るコマンド
==> Consider using `brew extract openssl ...`! This will extract your desired openssl version to a stable tap instead of installing from an unstable URL! ######################################################################## 100.0% Warning: openssl 1.1.1d is available and more recent than version 1.0.2t. ==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2t.catalina.bottle.tar.gz ==> Downloading from https://akamai.bintray.com/c9/c9c5e017edabe41ae55ed10ba5b94b834ee494e7f362d7245fbb0b137c876810?__gda__=exp=1576721482~hmac=6d292c122a002e1378734b75c45de418b8b70b346de86e35dc46a83240fa38b7&response-content-d ######################################################################## 100.0% ==> Pouring openssl-1.0.2t.catalina.bottle.tar.gz ==> Caveats A CA file has been bootstrapped using certificates from the SystemRoots keychain. To add additional certificates (e.g. the certificates added in the System keychain), place .pem files in /usr/local/etc/openssl/certs and run /usr/local/opt/openssl/bin/c_rehash openssl is keg-only, which means it was not symlinked into /usr/local, because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries. If you need to have openssl first in your PATH run: echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc For compilers to find openssl you may need to set: export LDFLAGS="-L/usr/local/opt/openssl/lib" export CPPFLAGS="-I/usr/local/opt/openssl/include" For pkg-config to find openssl you may need to set: export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig" ==> Summary 🍺 /usr/local/Cellar/openssl/1.0.2t: 1,795 files, 12MB Removing: /Users/name/Library/Caches/Homebrew/openssl--1.0.2t.catalina.bottle.tar.gz... (3.7MB)
$ brew list …略… openssl …略… openssl@1.1 …略…
入ったか確認。openssl
があれば成功です。
参考: Ruby 2.3.7 fails to install on macOS Mojave · Issue #4781 · rvm/rvm · GitHub
入らない時
Error: /usr/local/opt/openssl is not a valid keg
って言われる
まず確認
$ ls -ld /usr/local/opt/openssl drwxr-xr-x 3 name wheel 96 12 17 12:42 /usr/local/opt/openssl
このように出たら、/usr/local/opt/openssl
フォルダが残ってしまっていることが原因のようなので、削除します。
$ rm -r /usr/local/opt/openssl
rm
削除
-r
ディレクトリも含む
$ ls -ld /usr/local/opt/openssl ls: /usr/local/opt/openssl: No such file or directory
なくなったことを確認
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8b9d6d688f483a0f33fcfc93d433de501b9c3513/Formula/openssl.rb ==> Consider using `brew extract openssl ...`! This will extract your desired openssl version to a stable tap instead of installing from an unstable URL! ######################################################################## 100.0% Warning: openssl 1.1.1d is available and more recent than version 1.0.2t. ==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2t.catalina.bottle.tar.gz ==> Downloading from https://akamai.bintray.com/c9/c9c5e017edabe41ae55ed10ba5b94b834ee494e7f362d7245fbb0b137c876810?__gda__=exp=1576721482~hmac=6d292c122a002e1378734b75c45de418b8b70b346de86e35dc46a83240fa38b7&response-content-d ######################################################################## 100.0%
つらつらとインストールが流れたら成功!
参考: Brand new homebrew, can't install openssl, not valid keg - Homebrew
ありがとうございました!!!!!!助かりました....
お疲れ様でした > 自分
今日のオススメ漫画
セクシー田中さん
男心とか女心とかアラサー心とかを考えてしまいます。面白いです〜。フラワーコミックス好き。