I need some headers from the dev-version of postgres 9, which is contained in libpq-dev, for installing the pg gem, but when I execute:

sudo apt-get install libpq-dev

I get the result:

The following packages have unmet dependencies: libpq-dev : Depends: libpq5 (= 8.4.7-0ubuntu0.10.10) but 9.0.1-1~lucid is to be installed

When I tried to remove libpq5 (to reinstall it correctly?), it threatened to remove postgresql-9.0:

The following packages will be REMOVED: libpq5 pgadmin3 php5-pgsql postgresql-9.0 postgresql-client-9.0

Does anybody know how to solve this problem? Thanks.

2 Answers 2


I solved this for myself by running:

sudo apt-get remove libpq5
sudo apt-get install libpq-dev

Automatically fixed dependencies.


Finally I've reinstalled all that stuff, first I've removed old libpq5 and it's deleted all postgres-* packages, after that I've reinstalled postgresql-9.0 by downloading its binary from http://www.enterprisedb.com/products/pgdownload.do, and by accident postgresql-client-8.4 has been installed too. But all these things now works together.


gem install pg

was successful

Your Answer

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