Postgresql adapter (pg): could not connect to server Postgresql adapter (pg): could not connect to server postgresql postgresql

Postgresql adapter (pg): could not connect to server


Your Pg gem was compiled against the PostgreSQL libpq pre-installed in Mac OS X and you're using the psql that you installed in a newer version, or vice versa.

This can be worked around by specifying a TCP/IP connection, by adding localhost to database.yml, but it's better to compile the Pg gem against the libpq for the server you're actually running. To do that, you should be able to set the PATH environment variable to the folder with the correct pg_config in it before compiling. In your case that'll be somewhere within Postgres.app.


If it does not work even after adding host: localhost, remove the postmaster.pid

rm /usr/local/var/postgres/postmaster.pid