Search code examples
macospostgresqldylibotoolinstall-name-tool

How can I use `psql` without installing via brew


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

With the command otool -L psql I found path to the library was still pointing to Posgres.app, so I changed that with install_name_tool tool, and I also checked all referenced libraries and fixed them.

However, I still get the same error message. Anyone knows how to fix this?

Or another route to a working standalone psql binary?


Solution

  • 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.