Your PostgreSQL client library (libpq) was compiled against a different version of OpenSSL (libssl) than your dynamic linker is loading. This is not a problem with the 'pg' gem: libpq is part of PostgreSQL itself, and libssl is part of the OpenSSL library. You have to fix your environment before 'pg' can use it. This happens quite often when someone tries to replace the 'libpq' that comes with MacOS X (/usr/lib/libpq.dylib) with a version they've built themselves. If you don't ensure that your build also links against the libssl and libcrypto in /usr/lib (which are both version 0.9.8), loading it later causes this error.