Rails - Postgres Error: Reason: Incompatible Library Version: Libpq.5.Dylib Requires Version 1.0.0 or Later,

rails - postgres error: Reason: Incompatible library version: libpq.5.dylib requires version 1.0.0 or later,

I ran into this also, but was able to fix it following the instructions on python pip install psycopg2 install error.

First, make sure you have the most recent version of OpenSSL installed:

MacBook Pro:~> openssl version -a
OpenSSL 1.0.0c 2 Dec 2010
built on: Mon Jan 3 17:26:21 PST 2011
platform: darwin64-x86_64-cc
options: bn(64,64) rc4(ptr,char) des(idx,cisc,16,int) idea(int) blowfish(idx)
compiler: /usr/bin/gcc-4.2 -fPIC -fno-common -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -arch x86_64 -O3 -DL_ENDIAN -DMD32_REG_T=int -Wall
OPENSSLDIR: "/opt/local/etc/openssl"

...and note the OPENSSLDIR. On my system, it's in /opt/local/, because I installed it via MacPorts. I just needed to update the symlinks in /usr/lib/ for libssl.dylib and libcrypto.dylib so that they pointed to the correct versions in /opt/local/lib instead of the old version in usr/lib:

MacBook Pro:~> ls -la /usr/lib/libssl.dylib 
lrwxr-xr-x 1 root wheel 33 Aug 17 12:25 /usr/lib/libssl.dylib -> /opt/local/lib/libssl.1.0.0.dylib
MacBook Pro:~> ls -la /usr/lib/libcrypto.dylib
lrwxr-xr-x 1 root wheel 36 Aug 17 12:28 /usr/lib/libcrypto.dylib -> /opt/local/lib/libcrypto.1.0.0.dylib

You can create the links by using the ln command:

sudo ln -s /path/to/postgres/install/lib/libcrypto.dylib /usr/lib/libcrypto.dylib
sudo ln -s /path/to/postgres/install/lib/libssl.dylib /usr/lib/libssl.dylib

Rails pg gem Incompatible library version

Try:

$ gem install pg
$ gem pristine --all

Added by Vivi Poit on September 21, 2022:

This answer has been around for a while. It has just helped me, as well. However, it's always good to provide folks with some explanations as to why something works, so here are two resources I looked into before executing the commands:

3 Quick Gem Tricks by Justin Weiss

bundle pristine in Bundler Docs

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

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.

psql --version - Library not loaded

fixed by running this

sudo ln -fs /usr/lib/libssl.1.0.0.dylib /usr/lib/libssl.dylib
sudo ln -fs /usr/lib/libcrypto.1.0.0.dylib /usr/lib/libcrypto.dylib

Rails Server broken after PostgreSQL download

I really recommend you to use Homebrew to install postrgresql. It helps you to install all proper dependencies for version which correctly works with rails.

$ brew install postgresql

Do not forget to follow after install instructions from homebrew

gem install pg --with-pg-config works, bundle fails

Have you tried running this before running bundle install?

bundle config build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config

See http://bundler.io/v1.3/bundle_config.html

python pip install psycopg2 install error

I ran into a similar problem after upgrading to Mountain Lion.

Instead of copying libssl.* files per Slack's suggestion, make sure that /usr/lib/libssl.dylib is actually a soft link to the most up-to-date version of the library.

E.g., on my machine, ls -l /usr/lib/libssl* gives:

lrwxr-xr-x  1 root  wheel    46B Jun 27 15:24 /usr/lib/libssl.1.0.0.dylib -> /Library/PostgreSQL/9.1/lib/libssl.1.0.0.dylib
lrwxr-xr-x 1 root wheel 27B Jul 30 10:31 /usr/lib/libssl.dylib -> /usr/lib/libssl.1.0.0.dylib

If libssl.dylib doesn't link to the version that the error version mentions, make sure you have that version of the library, and then make sure /usr/lib/libssl.dylib points to it, and not an older version.

If the link doesn't exist, create it like so

sudo ln -s library_to_link_to link_to_create

using, of course, the proper locations for your machine. For me, this turned out to be:

sudo ln -s /usr/lib/libssl.1.0.0.dylib /usr/lib/libssl.dylib

Edit:

It seems like some are having trouble with part of my solution. Namely, deleting these important libraries even temporarily causes problems with the operating system.

Per Purrell's answer, make sure you include the -fs flags when you use the ln command, which helps ensure that the libraries don't go missing for a short period of time. E.g.,

sudo ln -fs /usr/lib/libssl.1.0.0.dylib /usr/lib/libssl.dylib
sudo ln -fs /usr/lib/libcrypto.1.0.0.dylib /usr/lib/libcrypto.dylib


Related Topics



Leave a reply



Submit