2

I wanted to deploy my rails app to Heoku, so I made new rails app and then changed Gemfile

gem 'sqlite'

to

gem 'pg'

and then I did

bundle install

in my terminal (my dev environment is Mac OS 10.8.2) and get the following result.

Fetching gem metadata from https://rubygems.org/.........
enter code hereUsing rake (0.9.2.2)
Using i18n (0.6.1) 
Using multi_json (1.3.6) 
Using activesupport (3.2.8)
Using builder (3.0.3) 
Using activemodel (3.2.8) 
Using erubis (2.7.0) 
Using journey (1.0.4) 
Using rack (1.4.1) 
Using rack-cache (1.2) 
Using rack-test (0.6.2) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.1.3) 
Using actionpack (3.2.8) 
Using mime-types (1.19) 
Using polyglot (0.3.3) 
Using treetop (1.4.10) 
Using mail (2.4.4) 
Using actionmailer (3.2.8) 
Using arel (3.0.2) 
Using tzinfo (0.3.33) 
Using activerecord (3.2.8) 
Using activeresource (3.2.8) 
Using bundler (1.2.0) 
Using coffee-script-source (1.3.3) 
Using execjs (1.4.0) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.2) 
Using json (1.7.5) 
Using rdoc (3.12) 
Using thor (0.16.0) 
Using railties (3.2.8) 
Using coffee-rails (3.2.2) 
Using jquery-rails (2.1.3) 
Installing pg (0.14.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb 
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib


Gem files will remain installed in /Users/haegwankim/.bundler/tmp/44175/gems/pg-0.14.1 for inspection.
Results logged to /Users/haegwankim/.bundler/tmp/44175/gems/pg-0.14.1/ext/gem_make.out
An error occurred while installing pg (0.14.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.14.1'` succeeds before bundling.</pre>

I did everything I could (google, friends, etc.) but couldn't figure out. I really appreciate someone could solve this problem. Cheers!

Chris Travers
  • 25,424
  • 6
  • 65
  • 182
popover
  • 71
  • 1
  • 4
  • Possible duplicate http://stackoverflow.com/questions/6209797/cant-find-the-postgresql-client-library-libpq – willglynn Oct 05 '12 at 06:23
  • Yea if I do sudo gem install pg (followed http://stackoverflow.com/questions/6209797/cant-find-the-postgresql-client-library-libpq), I've got error like Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/pg-0.14.1 for inspection. so it seems there's problem here as well. – popover Oct 05 '12 at 06:27
  • The error is "Can't find the PostgreSQL client library (libpq)". Do you have `libpq` installed? – willglynn Oct 05 '12 at 06:28
  • Yea I checked it out and seems I've got `libpq` in my mac because I downloaded full package from http://www.postgresql.org/download/ – popover Oct 05 '12 at 06:37

0 Answers0