Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Libssl and libcrypto causing dyld: Library not loaded: /usr/lib/libpq.5.dylib

I recently uninstalled postgresql and installed pyscopg2 via pip.

I know there's some trickery involved with libcrypto and libssl

Currently i have them symlinked to:

$ ls -lah libssl.*
-rwxr-xr-x  1 root  wheel   402K Aug 28 11:06 libssl.0.9.7.dylib
-rwxr-xr-x  1 root  wheel   589K Aug 28 11:06 libssl.0.9.8.dylib
lrwxr-xr-x  1 root  wheel    55B Nov 29 23:38 libssl.1.0.0.dylib -> /usr/local/Cellar/openssl/1.0.1c/lib/libssl.1.0.0.dylib
lrwxr-xr-x  1 root  wheel    55B Nov 30 02:25 libssl.dylib -> /usr/local/Cellar/openssl/1.0.1c/lib/libssl.1.0.0.dylib

/usr/lib
$ ls -lah libcrypto.*
-rwxr-xr-x  1 root  wheel   2.1M Aug 28 11:06 libcrypto.0.9.7.dylib
-rwxr-xr-x  1 root  wheel   2.6M Aug 28 11:06 libcrypto.0.9.8.dylib
-r-xr-xr-x  1 root  wheel   1.6M Oct 31 22:12 libcrypto.1.0.0.dylib
lrwxr-xr-x  1 root  wheel    58B Nov 30 02:27 libcrypto.dylib -> /usr/local/Cellar/openssl/1.0.1c/lib/libcrypto.1.0.0.dylib

whereby I installed openssl via ports

Now when I run arc diff, I am getting the infamous

$ arc diff
dyld: Library not loaded: /usr/lib/libpq.5.dylib
  Referenced from: /usr/bin/php
  Reason: image not found
Trace/BPT trap: 5

There are a few answers here in SO which talks about symlinking these libs to the postgresql install directory. Obviously, this won't work for me.

What should I do?

like image 323
disappearedng Avatar asked Nov 30 '12 10:11

disappearedng


4 Answers

Turns out /usr/lib/libpq.5.dylib was absent but /usr/lib/libpq.5.4.dylib was not.

sudo ln -s /usr/lib/libpq.5.4.dylib /usr/lib/libpq.5.dylib

fixed the issue.

like image 189
disappearedng Avatar answered Nov 15 '22 15:11

disappearedng


Not unlike @Pablo Marambio, I fixed this issue by adding the following line to ~/.profile:

export DYLD_LIBRARY_PATH=/Library/PostgreSQL/9.3/lib:$DYLD_LIBRARY_PATH

For Postgres.app v9.3.5.0 (presumably others too) I added the following line instead:

export DYLD_LIBRARY_PATH=/Applications/Postgres.app/Contents/Versions/9.3/lib:$DYLD_LIBRARY_PATH

Then, of course, run source ~/.profile

like image 44
metasequoia Avatar answered Nov 15 '22 15:11

metasequoia


just use the below commands in your terminal (use the proper postgresql version) $ brew unlink postgresql@14

$ brew link libpq --force

https://github.com/opentable/otj-pg-embedded/issues/152#issuecomment-954348544

like image 37
Akshay-stori Avatar answered Nov 15 '22 16:11

Akshay-stori


To resolve this, I had to uninstall postgresql and then install again.

$ brew uninstall postgresql

$ brew update

$ brew install postgres
like image 24
SuperNova Avatar answered Nov 15 '22 17:11

SuperNova