Search code examples
ruby-on-railspostgresqlmacos

Rails, Postgres: dyld: lazy symbol binding failed: Symbol not found: _PQresultMemorySize


creating a new rails-app (6.0.2) with postgres, on mac, could not get it to run.

Getting this error on app start:

dyld: Symbol not found: _PQresultMemorySize
  Referenced from: /Users/dev/.rvm/gems/ruby-2.5.7/gems/pg-1.2.2/lib/pg_ext.bundle
  Expected in: /usr/lib/libpq.5.dylib

enter image description here

This seems to be similar to dyld: lazy symbol binding failed: Symbol not found: _PQresultMemorySize - Rails,

but what is to do?

My previous rails apps, on rails v6.0.1, also with the same postgres gem 'pg', '>= 0.18', '< 2.0' are running just fine


Solution

  • I found the following workaround. It hardcodes the path to the shared library in the pg_ext.bundle:

    install_name_tool -change libpq.5.dylib /Library/PostgreSQL/12/lib/libpq.5.12.dylib pg_ext.bundle