brew updateのタイミングでReadlineのバージョンが上がってpryが使えなくなった時の対処


自分用メモですが、誰かの助けになれば、と。

エラー内容

    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.

下記で提示されているが、シンボリックリンクを貼るだけ。
https://github.com/deivid-rodriguez/byebug/issues/289#issuecomment-453943189
バージョンによってはリンク名を少し変更すれば上手くいくこともありそう。

$ ln -s /usr/local/opt/readline/lib/libreadline.dylib /usr/local/opt/readline/lib/libreadline.7.dylib

バージョン等は下記

$ 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
/usr/local/Cellar/readline/7.0.3_1 (46 files, 1.5MB)
  Poured from bottle on 2017-06-15 at 14:26:57
/usr/local/Cellar/readline/8.0.0 (48 files, 1.5MB)
  Poured from bottle on 2019-02-13 at 13:17:44
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/readline.rb
==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

For compilers to find readline you may need to set:
  export LDFLAGS="-L/usr/local/opt/readline/lib"
  export CPPFLAGS="-I/usr/local/opt/readline/include"

For pkg-config to find readline you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"

==> Analytics
install: 552,353 (30 days), 1,051,193 (90 days), 3,479,037 (365 days)
install_on_request: 67,280 (30 days), 108,614 (90 days), 330,266 (365 days)
build_error: 0 (30 days)
$ brew uses --installed readline
libimobiledevice       libxml2                python                 sqlite                 tig