Last Updated: February 25, 2016
·
1.691K
· lcguida

Installing dm-postgres-adapater with PostgreSQL 9.3 on Ubuntu

I followed DataMapper guide to install PostgreSQL adapter:

[$] sudo apt-get install postgresql-9.3 libpq-dev

Then, in my Gemfile:

(...)
gem 'data_mapper'
gem 'dm-postgres-adapter'
(...)

Whe I tried to bundle install, I got the following error:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /home/guida/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb 
checking for main() in -lpq... yes
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for postgres.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

After some research, I discovered that you need the header files for postgresql 9.3, which you can install by executing:

[$] sudo apt-get install postgresql-server-dev-9.3