LoginSignup
13
7

More than 5 years have passed since last update.

Mac & Rails でreadlineなエラーが起きた時に対応したこと

Posted at

ある日のこと、rspecを走らせたらエラーが発生

siukaido@siukaidos-MBA:~/sample$ bundle exec rspec
    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.

readline のバージョンが古いのかなぁと思い、brew upgrade をためしてみる

siukaido@siukaidos-MBA:~$ brew upgrade readline
Error: readline 7.0.3_1 already installed

・・・が、最新バージョンだった。
んー、どういうことだろうと思って info で見てみる。

siukaido@siukaidos-MBA:~$ brew info readline
readline: stable 7.0.3 (bottled) [keg-only]
Library for command-line editing
https://tiswww.case.edu/php/chet/readline/rltop.html
/usr/local/Cellar/readline/6.3.8 (46 files, 2.0MB)
  Poured from bottle on 2015-09-11 at 23:22:41
/usr/local/Cellar/readline/7.0.1 (46 files, 2MB)
  Poured from bottle on 2017-01-20 at 15:05:12
/usr/local/Cellar/readline/7.0.3_1 (46 files, 1.5MB) *
  Poured from bottle on 2017-03-22 at 11:26:03
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/readline.rb
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

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 this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/readline/lib
    CPPFLAGS: -I/usr/local/opt/readline/include

いくつかバージョンがあったので、とりあえず 6.3.8 にダウングレード。

siukaido@siukaidos-MBA:~$ brew switch readline 6.3.8
Cleaning /usr/local/Cellar/readline/6.3.8
Cleaning /usr/local/Cellar/readline/7.0.1
Cleaning /usr/local/Cellar/readline/7.0.3_1
Opt link created for /usr/local/Cellar/readline/6.3.8

したっけ、うまく動きましたとさ。
(ちなみに 7.0.1 だとダメでした)

13
7
3

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
13
7