title: What is causing this error when I try to install the pg gem?
body: <p>I'm trying to install the <a href="http://rubygems.org/gems/pg" rel="nofollow">pg gem</a>. </p>
  
  <pre><code>bens-macbook-pro:liferecord ben$ bundle config build.pg --with-pg-config=/users/ben/postgresql/bin
  bens-macbook-pro:liferecord ben$ bundle install
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>Installing pg (0.10.1) with native extensions /Users/ben/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
  
  /Users/ben/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb --with-pg-config=/users/ben/postgresql/bin
  Using config values from /users/ben/postgresql/bin
  *** 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=/Users/ben/.rvm/rubies/ruby-1.9.2-p0/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
  extconf.rb:13:in ``': Permission denied - /users/ben/postgresql/bin --includedir (Errno::EACCES)
      from extconf.rb:13:in `&lt;main&gt;'
  </code></pre>
  
  <p>What is causing this error?</p>
  
  <p>Extra info:</p>
  
  <p>I installed PostgreSQL from the <a href="http://www.enterprisedb.com/products-services-training/pgdownload#osx" rel="nofollow">one click installer</a>.</p>
  
  <p>Here is the output of the directory that I point to for pg-config:</p>
  
  <pre><code>bens-macbook-pro:bin ben$ ls
  clusterdb       droplang        pg_archivecleanup   pg_dumpall      pgbench         postmaster
  createdb        dropuser        pg_config       pg_resetxlog        pltcl_delmod        psql
  createlang      ecpg            pg_controldata      pg_restore      pltcl_listmod       reindexdb
  createuser      initdb          pg_ctl          pg_standby      pltcl_loadmod       vacuumdb
  dropdb          oid2name        pg_dump         pg_upgrade      postgres        vacuumlo
  </code></pre>
  
  <p>I'm running:</p>
  
  <pre><code>Rails 3.0.1
  Ruby 1.9.2
  OSX 10.6.6
  </code></pre>