Search code examples
rubypostgresqlruby-on-rails-5pgpostgresql-9.6

PG::Connection.ping fails with - Symbol not found: _PQping


I was getting this error on Postgres 9.4.1:

dyld: lazy symbol binding failed: Symbol not found: _PQping
  Referenced from: <home_dir>/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/pg-0.21.0/lib/pg_ext.bundle
  Expected in: /usr/local/lib/libpq.5.dylib

/usr/local/lib/libpq.5.dylib is linked to postgresql@9.6 version

/usr/local/lib/libpq.5.dylib -> ../Cellar/postgresql@9.6/9.6.5/lib/libpq.5.dylib

And then, I upgraded to 9.6.5 using:

brew install/upgrade

but still getting the error. The pg gem looks ok, I can connect from my Rails app and query my models.

How do I fix the error?


Solution

  • Try $ gem uninstall pg and then $ bundle install