LoginSignup
1
1

More than 5 years have passed since last update.

rails cでdyld: lazy symbol binding failed: Symbol not found

Posted at

rails cでDBにアクセスできない

rails cにてモデルのデータを取得しようとするとエラーが発生した

[1] pry(main)> user = User.find(1)
dyld: lazy symbol binding failed: Symbol not found: _rb_data_object_alloc
  Referenced from: /Users/hoge/.gems/gems/mysql2-0.4.3/lib/mysql2/mysql2.bundle
  Expected in: flat namespace

dyld: Symbol not found: _rb_data_object_alloc
  Referenced from: /Users/hoge/.gems/gems/mysql2-0.4.3/lib/mysql2/mysql2.bundle
  Expected in: flat namespace

ググってたらmysql2のgemを再インストールすればいいよって書かれてたから

$ sudo gem uninstall mysql2
$ sudo gem install mysql2

してみたけど動かない。(動く人もいるかもと思ってメモ)

rb-readlineというgemをインストールしたら動いた

group :development, :test do
  gem 'rb-readline' # これを追加
end

参考

Having Some Trouble With Pry And Setting Up Rails On My Machine!
rails console が動かない

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