まずエラー載せますね。
参考になるかもしれないのでエラーログまるごと。
YourName@YourName application_name % bundle exec rails c
Traceback (most recent call last):
42: from bin/rails:4:in `<main>'
41: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `require'
40: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:291:in `load_dependency'
39: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `block in require'
38: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
37: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
36: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
35: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
34: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
33: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/commands.rb:18:in `<top (required)>'
32: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/command.rb:44:in `invoke'
31: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/command.rb:70:in `find_by_namespace'
30: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/command/behavior.rb:39:in `lookup'
29: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/command/behavior.rb:39:in `each'
28: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/command/behavior.rb:40:in `block in lookup'
27: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/command/behavior.rb:40:in `each'
26: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/command/behavior.rb:44:in `block (2 levels) in lookup'
25: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `require'
24: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:291:in `load_dependency'
23: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `block in require'
22: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
21: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
20: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
19: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
18: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
17: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/commands/console/console_command.rb:4:in `<top (required)>'
16: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `require'
15: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:291:in `load_dependency'
14: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `block in require'
13: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
12: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
11: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
10: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
9: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
8: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/2.5.0/irb/completion.rb:10:in `<top (required)>'
7: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `require'
6: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:291:in `load_dependency'
5: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `block in require'
4: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
3: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
2: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
1: from /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/YourName/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require': dlopen(/Users/YourName/.rbenv/versions/2.5.1/lib/ruby/2.5.0/x86_64-darwin18/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib (LoadError)
Referenced from: /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/2.5.0/x86_64-darwin18/readline.bundle
Reason: image not found - /Users/YourName/.rbenv/versions/2.5.1/lib/ruby/2.5.0/x86_64-darwin18/readline.bundle
さて、これの解決方法について調べてみると、
- /usr/local/opt/readline/lib に以下のファイルを、->のようにシンボリックリンクする
- libreadline.dylib -> libreadline.dylib
- libhistory.dylib -> libreadline.dylib
- 7系のreadlineを入れて、そちらを使用するようにする
- rb-readlineを突っ込む
などが見受けられましたが、個人的には3が影響範囲小さくて良いなと思い、そちらを選択しました。
本当はもっとちゃんと調べたかったけど、rails console
を使いたいだけなのに、ここに時間を取られるのもアホらしいなと思ったので雑に解決。
おわりに
brew info readline
とかやっても7系のreadline出てこなかったんですが、もうインストールできないのだろうか?