pg gem and ruby app deployment issues

Evgeniy Litvinenko

Good day,

We have ruby application which requires gem 'pg' for connection to postgres db, for some reason I can't deploy it, it fails on bundle install phase, I used different ruby buildpacks and ruby versions but without any luck, our cf version is 212.

source ""

ruby '2.3.0'
gem "sinatra", "~> 1.4.3"
gem 'json'
gem 'rest-client'
gem 'pg'

Cloning into '/tmp/buildpacks/ruby-buildpack'...
Submodule 'compile-extensions' ( registered for path 'compile-extensions'
Cloning into 'compile-extensions'...
Submodule path 'compile-extensions': checked out '4a0e48afc46c1d467b7c75a8ae5e6f3a044d3d64'
-------> Buildpack version 1.6.16
Downloaded []
-----> Compiling Ruby/Rack
Downloaded []
-----> Using Ruby version: ruby-2.3.0
-----> Installing dependencies using bundler 1.11.2
Downloaded []
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Fetching gem metadata from
Fetching version metadata from
Using json 1.8.3
Installing netrc 0.11.0
Installing unf_ext with native extensions
Installing mime-types 2.99.1
Installing pg 0.18.4 with native extensions
Installing rack 1.6.4
Installing tilt 2.0.2
Using bundler 1.11.2
Installing rack-protection 1.5.3
Installing sinatra 1.4.7
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /tmp/staged/app/vendor/bundle/ruby/2.3.0/gems/pg-0.18.4/ext
/tmp/staged/app/vendor/ruby-2.3.0/bin/ruby -r ./siteconf20160422-297-z2ly6c.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***

Join to automatically receive all group messages.