title: Could not create Makefile for some reason
body: <p>I can't install the pg gem when I run bundle, or when I try to install it separately. The error I get is: "could not create Makefile." I'm running Mountain Lion, have Xcode installed, and have command line tools installed. I also have Postregsql installed via homebrew.</p>
  
  <p>I believe the error is because I can't create the makefile, which has surfaced as the error preventing me from doing other things.</p>
  
  <p>The full error I get is below.</p>
  
  <p>This error happens during the bundle. The other gems are installed fine, or are marked as using, then this error terminates the bundle while <code>installing pg (0.14.1) with native extensions</code></p>
  
  <pre><code>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/ericavirtue/.bundler/tmp/75812/gems/pg-0.14.1 for inspection.
  Results logged to /Users/ericavirtue/.bundler/tmp/75812/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.
  </code></pre>
  
  <p>I'm really at a loss for what to do here. I've been working on this for two days. </p>
  
  <p>EDIT:</p>
  
  <p>So when trying to find the path to implement the solution Christian Rapp suggested I found this recommendation: <code>sudo env ARCHFLAGS="-arch x86_64" gem install pg</code> which worked to install pg. Unfortunately I'm getting errors when I try to run <code>rails s</code>, <code>rake db:create:all</code>, or <code>rake db:migrate</code>. I'll create a separate question to trace those problems down ... </p>