OS:macOS Sierra 10.12.6
plant UMLをbrew経由で入れた際にbrew update
が走り、それによってopensslのversionが上がり、railsコマンドなどが使えなくなった。
opensslの1.1系
がrubyの2.4以下?
では使えないらしく、opensslを1.0系にdowngradeする必要があった。
####まず、現在のversionのopensslをuninstall
mac:~ qiita$ brew uninstall --ignore-dependencies openssl
--force
だと依存関係が残っているからできない的なエラーが出るため、--ignore-dependencies
を使用
####1.02tのversionをinstall
mac:~ qiita$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/64555220bfbf4a25598523c2e4d3a232560eaad7/Formula/openssl.rb -f
==> 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: You are using macOS 10.12.
We (and Apple) do not provide support for this old version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience while you are running this old version.
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.sierra.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/bd/bdbc44c56f63f27ab4dc12583b7f46a6485500f2a583dc8c9b848c4063f58927?__gda__=exp=1580442846~hmac=775cf3685e0ffaa1a5da455
######################################################################## 100.0%
==> Pouring openssl-1.0.2t.sierra.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"' >> ~/.bash_profile
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, 12.4MB
Removing: /Users/k.adachi/Library/Caches/Homebrew/openssl--1.0.2t.sierra.bottle.tar.gz... (3.7MB)
参考:Cannot install Ruby versions < 2.4 because of openssl@1.1 dependency#1353
🍺 /usr/local/Cellar/openssl/1.0.2t: 1,795 files, 12.4MB
上記のように配置されているのを確認
####新しくinstallしたopensslのpathを読ませる
mac:~ qiita$ echo 'export PATH=/usr/local/Cellar/openssl/1.0.2t/bin:$PATH' >> ~/.bash_profile
mac:~ qiita$ source ~/.bash_profile
####opensslが指定したversionになったことを確認。
mac:~ qiita$ openssl version
OpenSSL 1.0.2t 10 Sep 2019
これでbundle系
コマンドなどが打てるようになるはず
####補足
もし、rbenvを入れたいとかなら
RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/Cellar/openssl/1.0.2t" rbenv install 2.2.3
###参考
[Ruby] rbenv で「The Ruby openssl extension was not compiled.」が発生したときの対処