Search code examples
postgresqlmacoshomebrewruby-on-rails-3.1libreadline

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


I am working on a Ruby on Rails application and installed PostgreSQL using postgresql-9.1.2-1-osx.dmg. I installed the pg gem.

Then when I executed rake db:create, I got 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

I checked if /usr/local/lib/libpq.5.4.dylib existed or not. It did 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.

What should I do?


Solution

  • Some time after I posted this question, I found that libpq.5.4.dylib resides in /Library/PostgreSQL/9.1/lib/.
    So, I created the following link:
    lrwxr-xr-x 1 sathishvc admin 43 Jan 28 23:40 /usr/local/lib/libpq.5.4.dylib -> /Library/PostgreSQL/9.1/lib/libpq.5.4.dylib.

    This solved the problem then.