LoginSignup
0
2

More than 5 years have passed since last update.

"Sorry, you can't use byebug without Readline." 解決方

Last updated at Posted at 2019-03-25
    Sorry, you can't use byebug without Readline. To solve this, you need to
    rebuild Ruby with Readline support. If using Ubuntu, try `sudo apt-get
    install libreadline-dev` and then reinstall your Ruby.
/Users/...1/lib/active_support/dependencies.rb:274:in `require': dlopen(/Users/.../x86_64-darwin15/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
  Referenced from: /Users/.../x86_64-darwin15/readline.bundle
  Reason: image not found - /Users/.../x86_64-darwin15/readline.bundle

readline のバージョンが変わったせいで使えなくなっているみたい。
https://github.com/deivid-rodriguez/byebug/issues/289

brew info してみると、3/21に brew update でreadlineがバージョン8になったからだと思われる。

$ brew info readline
readline: stable 8.0.0 (bottled) [keg-only]
Library for command-line editing
https://tiswww.case.edu/php/chet/readline/rltop.html
/opt/brew/Cellar/readline/7.0.5 (46 files, 1.5MB)
  Poured from bottle on 2018-08-09 at 22:05:58
/opt/brew/Cellar/readline/8.0.0 (48 files, 1.5MB)
  Poured from bottle on 2019-03-21 at 13:35:56

解決法として3つあったが、今回はRubyの再インストールで解決した。

1. Ruby を再インストール

$ rbenv uninstall 2.5.3
$ rbenv install 2.5.3

rbenv 使ってるから、Ruby の再インストールをためらう理由がなかった。それにプロジェクトのRubyバージョンアップでteenyバージョンをあげることもあるし、再インストールでいいと思う。

2. rb-readline gem をインストールする

rb-readline gem も問題あるみたい

3. symlink 貼り替える

$ ln -s /usr/local/opt/readline/lib/libreadline.dylib /usr/local/opt/readline/lib/libreadline.6.dylib
https://github.com/deivid-rodriguez/byebug/issues/289#issuecomment-265082757

しかし、v8になって過去バージョンのバイナリ残ってなかったから使えない。
代わりに brew switch readline 7.0.5 すると解決できる

$ ls -al /usr/local/opt/readline/lib
total 1448
drwxr-xr-x  11 hoge  staff     352 12 20 06:07 .
drwxr-xr-x  12 hoge  staff     384  3 21 13:35 ..
-r--r--r--   1 hoge  staff   40396  3 21 13:35 libhistory.8.0.dylib
lrwxr-xr-x   1 hoge  staff      20 12 20 06:07 libhistory.8.dylib -> libhistory.8.0.dylib
-r--r--r--   1 hoge  staff   45848 12 20 06:07 libhistory.a
lrwxr-xr-x   1 hoge  staff      20 12 20 06:07 libhistory.dylib -> libhistory.8.0.dylib
-rw-r--r--   1 hoge  staff  239260  3 21 13:35 libreadline.8.0.dylib
lrwxr-xr-x   1 hoge  staff      21 12 20 06:07 libreadline.8.dylib -> libreadline.8.0.dylib
-r--r--r--   1 hoge  staff  406384 12 20 06:07 libreadline.a
lrwxr-xr-x   1 hoge  staff      21 12 20 06:07 libreadline.dylib -> libreadline.8.0.dylib
drwxr-xr-x   3 hoge  staff      96  3 21 13:35 pkgconfig

bundler インストール

rubyを再インストールして bundle install しようとしたところ、今度は以下のエラーが出た。

can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)

これは bundler (2.0.1) がインストールされたからで、 Gemfile.lock の1.17.3と合わないからだ。

解決法1.17.3 を入れたらokです。

gem install bundler -v 1.17.3

Bundlerは.lock ファイルをみて勝手に切り替えてくれるようなので 2.0.1 は残しても問題なさそう。gem list でも両方インストールされている。

$ gem list
...
bundler (2.0.1, 1.17.3)
...
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2