I will be installing PostGIS for my project using PostgreSQl (OSM) in Ubuntu 9.04. I had all the requirements prior to the installation (PostgreSQL, Proj4, GEOS). When I unzip the PostGIS tar, then './configure' it, it says that the pg_config.h file is missing. I found out that I need to 'apt-get install libpq-dev' for me to able to have this file and past it as parameter to ./configure --with-pgconfig=PATH. When I executed this, this is what happens:

checking for libiconv_open in -liconv... no
checking for iconv_open in -lc... yes
Using user-specified pg_config file: /usr/include/postgresql/pg_config.h
./configure: line 16394: /usr/include/postgresql/pg_config.h: Permission denied
./configure: line 16404: /usr/include/postgresql/pg_config.h: Permission denied
./configure: line 16405: /usr/include/postgresql/pg_config.h: Permission denied
./configure: line 16406: /usr/include/postgresql/pg_config.h: Permission denied
checking PostgreSQL version...
./configure: line 16411: test: : integer expression expected
./configure: line 16416: test: : integer expression expected
./configure: line 16426: test: : integer expression expected
./configure: line 16433: /usr/include/postgresql/pg_config.h: Permission denied
./configure: line 16434: /usr/include/postgresql/pg_config.h: Permission denied
./configure: line 16439: /usr/include/postgresql/pg_config.h: Permission denied
./configure: line 16440: /usr/include/postgresql/pg_config.h: Permission denied
./configure: line 16445: /usr/include/postgresql/pg_config.h: Permission denied
./configure: line 16449: /usr/include/postgresql/pg_config.h: Permission denied
checking libpq-fe.h usability... no
checking libpq-fe.h presence... no
checking for libpq-fe.h... no
configure: error: could not find libpq-fe.h

I checked in the /usr/include/postgresql/ directory and I found the pg_config.h and libpq-fe.h files there.

What can I be missing here?

  • Are you running ./configure as the root user? – mwalker Sep 10 '10 at 19:13
  • yes, I am. I logged in as root to make sure. – John Bautista Sep 13 '10 at 18:30
  • 1
    I suspect that 'apt-get install libpq-dev didn't work properly, as the 9.04 distro is no longer supported (too old). Can you run the pg_config command? – Mike T May 18 '11 at 19:58
  • @Mike I only now saw your comment, but posted a similar answer -- have to make sure the Postgres install went cleanly, which should be OK but is potentially tricky on an unsupported system. – scw May 19 '11 at 8:14
  • I am having the same problem . – user7065 Apr 20 '12 at 15:05

Try installing the package available on Synaptic:

alt text

  • I'm using Ubuntu 9.04. I cannot see that in my Synaptic. Does my Ubuntu version matters here? – John Bautista Sep 13 '10 at 18:56
  • 1
    if it does not appear, try to activate the 'universe' packages. – julien Sep 15 '10 at 12:35
  • 1
    You might want to update your OS, since Ubuntu 9.04 "Jaunty Jackalope" was dropped from support 23 Oct 2010 – Mike T May 18 '11 at 19:53

You may need to elevate your permission level for the install to work. ( I believe sudo !! will re-do the previous command with elevated permissions.)

Otherwise, perhaps pg_config.h is currently marked as read-only.


I am not sure what method you used to install the Postgresql portion, because if I remember correctly, it installs the DBMS through a 'new user' called 'postgres'.

Have you tried to run the PostGIS configure through the postgres user? I believe that user has write permissions to those files your user is being denied.

try from the command line: sudo -u postgres ./configure

It should ask for your su password.

The easiest way by far to install postgis into your postgresql db is to use the 'Stack Builder' that comes with postgresql.

You can also configure the permissions to allow other users to have write access. That exact process I can't remember but it is in the Postgresql documentation.


You need to point the PostGIS installer at the location of the pg_config binary, by adding the --with-pg variable pointing at wherever the pg_config binary is installed on your machine. pg_config, something like:


You can locate its specific location on your machine with which pg_config.


With PostGIS 2.0.3 and Postgresql 9.2.3 installed from source on Ubuntu 12.10, I found this to work:

./configure --with-pgconfig=/usr/local/pgsql/bin/pg_config

Previously, I'd tried to be clever by linking some pgsql binaries and includes but that didn't work. Best to stick the prescribed method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.