Skip to content

Instantly share code, notes, and snippets.

@marksweiss
Last active August 29, 2015 14:05
Show Gist options
  • Save marksweiss/b2d6f73abe818d56b5fd to your computer and use it in GitHub Desktop.
Save marksweiss/b2d6f73abe818d56b5fd to your computer and use it in GitHub Desktop.
Get Postgres and psycopg2 to work on OSX Mavericks 10.9.4
-- 1) Install Postgres.app, seriously (Before doing this I was wrestling with a socket error connecting to the DB that many people have on StackOverflow etc. but multiple remedies didn't work. Feel free to waste time on this but I stopped wasting time on it this way.)
-- 2) Append path to Postgres.app bin directory to end of $PATH in .bash_profile
-- 3) At this point running py scripts that include psycopg2 will work, but import
-- in the (Anaconda, (YMMV with other Py shells)) Python shell will not, so ...
-- 4) $ sudo ln -s /Applications/Postgres.app/Contents/Versions/9.3/lib/libssl.1.0.0.dylib /opt/local/lib/libssl.1.0.0.dylib
-- 5) $ sudo ln -s /Applications/Postgres.app/Contents/Versions/9.3/lib/libcrypto.1.0.0.dylib /opt/local/lib/libcrypto.1.0.0.dylib
-- (Anaconda, (YMMV with other Py shells)) Psycopg2 in Python shell can't find and link to these dylibs that
-- are part of Postgres distro unless there are sym links in the fs under the same user
-- that launches the Python shell
-- 6) Use the default data directory in Postgres.app
-- 7) createdb -h localhost
-- This gets past error where launching the db gives error:
-- psql: FATAL: database "<USER>" does not exist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment