I upgraded to El Capitan today and of course had to reinstall homebrew and all my python and development tools. I went to try to run a django app on my machine and kept getting this error:
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: dlopen(/Users/macuser/.virtualenvs/cjf/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: @loader_path/../lib/libssl.1.0.0.dylib
Referenced from: /Users/macuser/.virtualenvs/cjf/lib/python2.7/site-packages/psycopg2/_psycopg.so
This was pretty frustrating. After a lot of googling I found out that i could link to the libssl.1.0.0.dylib in my Postgres.app (which i am very fond of by the way) I was not able to find the exact correct instructions do do this on El Capitan because of some new security measures. I kept getting this error when trying to link in /usr/lib as I was instructed.:
ln: libssl.1.0.0.dylib: Operation not permitted
I figured out that /usr/local/lib works for this link too, and you don’t get that error message.
cd /usr/local/lib
sudo ln -s /Applications/Postgres.app/Contents/MacOS/lib/libssl.1.0.0.dylib
sudo ln -s /Applications/Postgres.app/Contents/MacOS/lib/libcrypto.1.0.0.dylib
UPDATE:
With the latest Postgres.app this worked for me:
cd /usr/local/lib
sudo ln -s /Applications/Postgres.app/Contents/Versions/9.6/lib/libssl.1.0.0.dylib
sudo ln -s /Applications/Postgres.app/Contents/Versions/9.6/lib/libcrypto.1.0.0.dylib
This worked great for me. After softlinking these files in, psycopg2 module started loading just fine.