Postgresapp: SSL issues after El Capitan upgrade

Created on 26 Oct 2015  路  10Comments  路  Source: PostgresApp/PostgresApp

(Related to #285)

I'm running Postgres.app 9.4.4 and I just upgraded to El Capitan. While Postgres.app works the same locally, I can no longer connect to a Heroku database with a Rails database URL. Instead I get the dreaded no pg_hba.conf entry for host error, which Google tells me is related to SSL not being compiled in my version of Postgres.

Is anyone else seeing this? Is there anything I can try?

Most helpful comment

Thanks for the help, @jakob! It appears to work after uninstalling and recompiling the pg gem; not sure why that was necessary but thanks for the suggestion!

All 10 comments

The same problem occurs for me with Postgres.app 9.4.5.

Additionally, when I add ?sslmode=require to the URL string as suggested here I get this error: sslmode value "require" invalid when SSL support is not compiled in (PG::ConnectionBad)

It looks like Rails is using a build of libpq that doesn't have SSL support. Postgres.app definitely has SSL support (or TLS support, to be precise).

This means that you probably have a second PostgreSQL installation on your Mac.

I'm not a Ruby user myself, so please take the following advise with a grain of salt.

I assume that when you built/installed the postgres gem, you linked against the other version of PostgreSQL that's installed on your Mac. I think ruby uses the pg_config tool to find the PostgreSQL installation details. Type which pg_config in your Terminal. It should say:

/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config

If it says something else, ruby probably linked against that other install.

To make sure ruby can find the libraries provided by Postgres.app, configure your path correctly before installing the pg gem. See this page for instructions on configuring your path: http://postgresapp.com/documentation/cli-tools.html

which pg_config does indeed point to the Postgres.app version, and even changing my shell's $PATH to have Postgres.app as the very first item still doesn't solve this issue. I'm not sure what else to try to get to the bottom of this.

In that case, try recompiling the pg gem.

For troubleshooting, try to find the pg gem and use the command otool -L /path/to/gem to determine which libraries it links against. The version of libpq supplied with Postgres.app definitely is compiled with SSL support, so I'm pretty sure that the pg gem links against a different library.

(it doesn't matter what your $PATH points to now, it only matters what your $PATH pointed to when you compiled the pg gem)

In any case, I'd be happy if someone who actually uses ruby would chime in; I am pretty much just guessing here...

Thanks for the help, @jakob! It appears to work after uninstalling and recompiling the pg gem; not sure why that was necessary but thanks for the suggestion!

I had to do the same thing in my Python virtual environment. I originally created the venv and installed dependencies like psycopg2 when I had a different postgres install. Wiping my venv and recreating it now that I'm using Postgres.app solved this same problem for me.

@tomreece solution to wipe the old venv and create a new one worked for me. I hits this issue after I upgraded from 9.4 to 9.5.

Was this page helpful?
0 / 5 - 0 ratings