PG::ConnectionBad – could not connect to server: Connection refused

It could be as simple as a stale PID file. It could be failing silently because your computer didn’t complete the shutdown process completely which means postgres didn’t delete the PID (process id) file. The PID file is used by postgres to make sure only one instance of the server is running at a time. So when it goes to … Read more

Can’t find the ‘libpq-fe.h header when trying to install pg gem

It looks like in Ubuntu that header is part of the libpq-dev package (at least in the following Ubuntu versions: 11.04 (Natty Narwhal), 10.04 (Lucid Lynx), 11.10 (Oneiric Ocelot), 12.04 (Precise Pangolin), 14.04 (Trusty Tahr) and 18.04 (Bionic Beaver)): So try installing libpq-dev or its equivalent for your OS: For Ubuntu/Debian systems: sudo apt-get install libpq-dev On Red Hat Linux (RHEL) systems: yum install postgresql-devel For Mac Homebrew: brew install postgresql For Mac MacPorts PostgreSQL: gem install pg — –with-pg-config=/opt/local/lib/postgresql[version number]/bin/pg_config … Read more