Install PostgreSQL Database Driver

By | 5th January 2016


  • OS: Debian 8
  • PostgreSQL, Ruby and Rails installed
  • Part of efforts to write a small Ruby on Rails reporting application which requires connection to PostgreSQL database.
  • Attempt to install PostgreSQL database driver and got “missing library” error.
> gem install postgresql
Building native extensions.  This could take a while...
ERROR:  Error installing postgresql:
ERROR: Failed to build gem native extension./usr/bin/ruby2.1 extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.


Because this is for connect to PostgreSQL database hence install libpq-dev

> sudo apt-get install libpq-dev

After that is completed

> gem install postgresql

No further error.



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.