title: Difficulty bundling pg using Mac Postgres App
body: <p>I've tried bundling my Rails app on my Mac at work. At home it works fine and I've managed it solve it myself previously but this time no matter what I try nothing appears to be working to resolve it.</p>
  
  <p>The error I receive when running bundle/bundle install is the following:</p>
  
  <blockquote>
    <p>Installing pg (0.17.0)
    Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.</p>
  
  <pre><code>/Users/notrab/.rbenv/versions/2.0.0-p0/bin/ruby extconf.rb
  </code></pre>
    
    <p>checking for pg_config... no
    No pg_config... trying anyway. If building fails, please try again with
     --with-pg-config=/path/to/pg_config
    checking for libpq-fe.h... no
    Can't find the 'libpq-fe.h header
    <strong>* extconf.rb failed *</strong>
    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.</p>
    
    <p>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=/Users/notrab/.rbenv/versions/2.0.0-p0/bin/ruby
      --with-pg
      --without-pg
      --with-pg-config
      --without-pg-config
      --with-pg_config
      --without-pg_config
      --with-pg-dir
      --without-pg-dir
      --with-pg-include
      --without-pg-include=${pg-dir}/include
      --with-pg-lib
      --without-pg-lib=${pg-dir}/</p>
    
    <p>Gem files will remain installed in /Users/notrab/Sites/Integrity/vendor/bundle/gems/pg-0.17.0 for inspection.</p>
    
    <p>Results logged to /Users/notrab/Sites/Integrity/vendor/bundle/gems/pg-0.17.0/ext/gem_make.out</p>
    
    <p>An error occurred while installing pg (0.17.0), and Bundler cannot continue.
    Make sure that <code>gem install pg -v '0.17.0'</code> succeeds before bundling.</p>
  </blockquote>
  
  <p>I've obviously tried running</p>
  
  <blockquote>
    <p>gem install pg -v '0.17.0' and it says it was successful but bundling again shows the same error.</p>
  </blockquote>
  
  <p>I have also tried running</p>
  
  <blockquote>
    <p>gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config</p>
  </blockquote>
  
  <p>Which is outlined in the documentation <a href="http://postgresapp.com/documentation" rel="nofollow">http://postgresapp.com/documentation</a> but the same error occurs when I try to bundle.</p>
  
  <p>I'm going round in circles and don't know how to resolve it.</p>
  
  <p>My Gemfile looks like:</p>
  
  <pre><code>group :development, :test do
      gem "better_errors"
      gem 'meta_request'
      gem 'binding_of_caller'
      gem 'sqlite3'
  end
  
  group :production do
      gem 'pg'
  end
  </code></pre>
  
  <p>Many thanks,</p>
  
  <p>Jamie</p>