Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

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

More than 3 years have passed since last update.

ある日のこと、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 だとダメでした)

siukaido
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away