Super Spread Sheet S³

Or little computing tricks and hacks

psql as a gem

The initial Rails infrastructure uses sqlite3 as the default database. Heroku, on the other hand, uses postgresql. Given that Heroku advices the use of the same database for development as for deployment, in the sample app of the tutorial it is advised to upgrade to psql.

When running gem install pg -v '0.15.1', I got a nasty error:

ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
[…]
Can’t find the ‘libpq-fe.h header
*** 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 come searching, I found that in Ubuntu, I need to install an extra package:
sudo apt-get install libpq-dev

And presto. After installation, the gem is happily installed:

$ gem install pg -v ‘0.15.1’
Building native extensions. This could take a while…
Successfully installed pg-0.15.1
1 gem installed

The trick was found in this site. There are some header files missing, needed by gem install, available after libpq-dev is installed.

Advertisements

One response to “psql as a gem

  1. Pingback: Postgresql, rspec and selenium-webdriver | Super Spread Sheet S³

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: