Monday, August 1, 2016

Can't find the 'libpq-fe.h header

This is a very common error when you are make your

$ bundle install

in a Rails project using PostgreSQL. And the solution is very simple.

This error means a certain header is missing when compiling PostgreSQL native extensions. This header is provided, at my Debian 8 Linux distribution, by a package named libpq-dev. Then you just need to do

$ sudo apt-get install libpq-dev

and it will be installed.

When I'm using Fedora (before 22), I just do

$ sudo yum install /usr/include/libpq-fe.h

or, if your Fedora version is 22+, try the same with the new package manager, dnf

$ sudo dnf install /usr/include/libpq-fe.h

I am sure you may find this header for your distribution by using the greatest programming helper of all times, Google.