1

After installing the pg gem, I'm getting this error when I try to start the server on my local machine:

/Users/foo/.rvm/gems/ree-1.8.7-2011.12/gems/pg-0.14.0/lib/pg_ext.bundle: dlopen(/Users/foo/.rvm/gems/ree-1.8.7-2011.12/gems/pg-0.14.0/lib/pg_ext.bundle, 9): Library not loaded: @loader_path/../lib/libssl.dylib (LoadError)
Referenced from: /usr/lib/libpq.5.dylib
Reason: Incompatible library version: libpq.5.dylib requires version 1.0.0 or later, but libssl.dylib provides version 0.9.8 - /Users/foo/.rvm/gems/ree-1.8.7-2011.12/gems/pg-0.14.0/lib/pg_ext.bundle

I have an up to date version of openssl installed on my machine via macports but it seems like the gem is looking at the older version that I have installed in /usr/lib for some reason (maybe something to do with a messed up @loader_path?).

'openssl version' gives me 'OpenSSL 1.0.1c 10 May 2012'

and 'which openssl' gives me '/opt/local/bin/openssl' as I expected

Any help is really appreciated. Thanks!

blim8183
  • 768
  • 1
  • 8
  • 23
  • Do NOT remove it from `/usr/lib`. That is owned by the OS and any applications needing it will fail if they don't find it, which will make you regret having removed it. That is the standard location for library files like `libssl`. The version installed by MacPorts is in an optional location so you have to tell Gem where to look when it's installing the Pg files. – the Tin Man Jul 30 '12 at 16:43
  • Have you tried `$ gem update libssl`? – AJcodez Jul 30 '12 at 17:33

1 Answers1

2

I just ran into this problem after updating to Mountain Lion. After checking that I had a proper OpenSSL version, I did the following.

$ ls /Library/PostgreSQL/9.1/lib/libssl*

Provided the following:

/Library/PostgreSQL/9.1/lib/libssl.1.0.0.dylib
/Library/PostgreSQL/9.1/lib/libssl.dylib
/Library/PostgreSQL/9.1/lib/libssl.a

I copied the file as so:

$ sudo cp /Library/PostgreSQL/9.1/lib/libssl.1.0.0.dylib /usr/lib/

Then linked:

$ cd /usr/lib
$ ln -sf libssl.1.0.0.dylib libssl.dylib

After that, I tried rails s again and the same error came up with a different file, so I repeated the process (libcrypto):

 requires version 1.0.0 or later, but libcrypto.0.9.8.dylib 
 provides version 0.9.8

so:

$ sudo cp /Library/PostgreSQL/9.1/lib/libcrypto.1.0.0.dylib /usr/lib/
$ cd /usr/lib
$ ln -sf libcrypto.1.0.0.dylib libcrypto.dylib

See this question's answers for reference as well: python pip install psycopg2 install error

Community
  • 1
  • 1
RyanB
  • 707
  • 1
  • 5
  • 18