PostgreSQL – How to Use `psql` Without Installing via Brew on Mac OS X

installationmac os xpostgresqlpsql

I want to use the psql utility standalone, without installing postgress via brew or something (I have my reasons). I use psql version 9.5.3 on OS X, which was distributed with PostgressApp.

When I only distribute psql, I get the error:

dyld: lazy symbol binding failed: Symbol not found: _PQsslInUse
...
Expected in: /usr/lib/libpq.5.dylib

On most computers, /usr/lib/libpq.5.5.dylib is installed, but I use version 5.6. So then I tried distributing libpq.5.6.dylib in the same folder. This doesn't work, even when I set the $DYLD_LIBRARY_PATH variable.

Any pointers?

Best Answer

I fixed it here: https://github.com/PostgresApp/PostgresApp/issues/338

The problem was I used install_name_tool not 100% correctly, and I forgot to create aliases.