49
28

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

rails console で readline がないよって怒られたときの対処例

Last updated at Posted at 2019-01-25

こんにちは。Rails勉強中の @koshi_life です。

rails console でコードの確認がインタラクティブに確認できて便利だと聞いて、Rails consoleしたら readline ってライブラリがないぜってコケたので、ライブラリの設定メモ

  • 環境
    • Mac OS High Sierra
    • homebrew インストール済み

エラー内容

$ rails c
Traceback (most recent call last):
	14: from bin/rails:4:in `<main>'
	13: from bin/rails:4:in `require'

	..略..

	 1: from /Users/kenjikoshikawa/.rbenv/versions/2.6.0/lib/ruby/2.6.0/irb/completion.rb:10:in `<top (required)>'
/Users/kenjikoshikawa/.rbenv/versions/2.6.0/lib/ruby/2.6.0/irb/completion.rb:10:in `require': dlopen(/Users/kenjikoshikawa/.rbenv/versions/2.6.0/lib/ruby/2.6.0/x86_64-darwin17/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib (LoadError)
  Referenced from: /Users/kenjikoshikawa/.rbenv/versions/2.6.0/lib/ruby/2.6.0/x86_64-darwin17/readline.bundle
  Reason: image not found - /Users/kenjikoshikawa/.rbenv/versions/2.6.0/lib/ruby/2.6.0/x86_64-darwin17/readline.bundle

readline入ってないと思い、 brew install してみる。

$ brew install readline
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).

..略..

Warning: readline 8.0.0 is already installed and up-to-date

既に8.0.0のreadlineはインストール済みとのことだったが、 /usr/local/opt/readline/lib/libreadline.7.dylib には存在しないとのことなので、参考リンクを参考にシンボリックリンクを張る。

$ ln -s /usr/local/opt/readline/lib/libreadline.dylib /usr/local/opt/readline/lib/libreadline.7.dylib
$ bundle install --path vendor/bundle
$ rails c
irb(main):001:0> 

できた。
rails console とても便利ですね。

参考: https://qiita.com/kanpou0108/items/0fe67e313c03e87277e7

49
28
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
49
28

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?