title: Cannot install pg gem in Mavericks with Postgres.app
body: <p>I am trying to install the pg gem for use with Postgres.app on my local machine. I am running Mavericks.</p>
  
  <p>Postgres.app is installed and running fine, but I cannot get the gem to work. I've done the following:</p>
  
  <ol>
  <li>Used the command 'env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config' from the Postgres.app documentation</li>
  <li>Updated Homebrew and installed the Apple GCC 4.2</li>
  <li>Installed the Xcode developer tools</li>
  <li>Updated my $PATH to reference both the Postgres.app bin and lib directories</li>
  </ol>
  
  <p>All with no success. Here is the specific error message I receive:</p>
  
  <pre><code>Building native extensions with: '--with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config'
  This could take a while...
  ERROR:  Error installing pg:
      ERROR: Failed to build gem native extension.
  
      /Users/Brian/.rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
  Using config values from /Applications/Postgres.app/Contents/MacOS/bin/pg_config
  sh: /Applications/Postgres.app/Contents/MacOS/bin/pg_config: No such file or directory
  sh: /Applications/Postgres.app/Contents/MacOS/bin/pg_config: No such file or directory
  checking for libpq-fe.h... no
  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.
  
  Provided configuration options:
      --with-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/Brian/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
      --with-pg
      --without-pg
      --with-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}/
  </code></pre>
  
  <p>I'd appreciate any help you can offer. Thanks!</p>