Library not loaded: /usr/local/lib/libpq.5.4.dylib

Sathish picture Sathish · Jan 26, 2012 · Viewed 11.7k times · Source

I am working on a rails app.
Installed Postgresql using postgresql-9.1.2-1-osx.dmg
Installed pg gem.
Then when I executed rake db:create getting the following error -

dlopen(/Users/sathishvc/.rvm/gems/ruby-1.9.3-head@knome-vivacious/gems/pg-0.12.2/lib/pg_ext.bundle, 9): Library not loaded: /usr/local/lib/libpq.5.4.dylib

Checked if /usr/local/lib/libpq.5.4.dylib exists or not. It does not.
So, it should be existing somewhere else in the system or I do not know, if I need to install any other piece of software for this.

Advice anyone please?

Answer

awenkhh picture awenkhh · Oct 10, 2013

if you have upgraded PostgreSQL with homebrew (brew update && brew upgrade), then simply uninstall the pg gem:

gem uninstall pg
bundle install

and the path will be corrected for you. No need to uninstall the whole PostgreSQL cluster.