2021年にまたやらかした。
thoames.hatenadiary.jp
=============
原因が何だったのか定かではないが、
恐らくXcode関係かbrew関係のコマンドを弄ったかが原因で
Railsを起動しようとしたところ以下のようなエラーが表示された。
$ bundle exec rails s
...
LoadError - library not found for class Digest::SHA1 -- digest/sha1
...
ruby on rails - LoadError: dlopen(digest/sha1.bundle): Symbol not found: _rb_Digest_SHA1_Finish - Stack Overflow
ios - Ruby: LoadError - library not found for class Digest::SHA1 -- digest/sha1 - Stack Overflow
どうやらOpenSSLが直接的な原因であったようで
/usr/local/opt/opensslのシンボリックリンクが「../Cellar/openssl@1.1/1.1.1d」を指していたのが原因っぽい。(あくまでも予想)
そしてこの問題が発生したときは、情報があまりなかったので
安易にRubyを再インストールすればよいと思ってしまい、使用していたRuby 2.3.1を消してしまったことから悲劇が始まった。
Bundlerが原因でRailsが動かない。
bundle exec rails sを行うために、bundlerのインストールが必要だが、後々2系だと自分が使用しているgemと相性が悪いので
古いバージョンのbundlerをインストールした
$ gem install bundler -v 1.17.1
$ gem list
...
bundler (1.17.1)
...
lib8とtherubyracerがインストールできない
以下の記事と同じことを行ったらインストールできた。
$ brew install v8-315
$ bundle config --local build.libv8 --with-system-v8
You are replacing the current local value of build.libv8, which is currently nil
$ bundle config --local build.therubyracer --with-v8-dir=$(brew --prefix v8-315)
You are replacing the current local value of build.therubyracer, which is currently nil
$ bundle install