title: Problems installing the pg gem with rvm, postgres 9.0, ruby 1.9.2-p136 on 64 bit Snow Leopard
body: <p>I want to build a Rails 3 app for Heroku.
  They use Postgres as their db so I installed postgres 9.0 via MacPorts.
  Now I need a postgres gem and the consensus is that for performance reasons
  you want the pg gem. However I'm completely baffled by the errors I'm getting
  when I try and install pg via gem install under rvm.</p>
  
  <p>I have been very explicit by specifying where all the postgres directories
  are to be found but still am unable to complete the install:</p>
  
  <pre><code>$ env ARCHFLAGS='-arch x86_64' gem install pg -- \
     --with-pg-config=/opt/local/var/db/postgresql90/defaultdb/postgresql.conf \
     --with-pg-include=/opt/local/include/postgresql90/ \
     --with-pg-lib=/opt/local/lib/postgresql90/
  
  Using config values from /opt/local/var/db/postgresql90/defaultdb/postgresql.conf
  *** 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/guy/.rvm/ruby-1.9.2-p136/bin/ruby
      --with-pg
      --without-pg
      --with-pg-dir
      --without-pg-dir
      --with-pg-include=${pg-dir}/include
      --with-pg-lib=${pg-dir}/lib
      --with-pg-config
  extconf.rb:24:in ``': Exec format error - /opt/local/var/db/postgresql90/defaultdb/postgresql.conf --includedir (Errno::ENOEXEC)
      from extconf.rb:24:in `&lt;main&gt;'
  </code></pre>
  
  <p>Anyone got any ideas?
  I'm baffled.
  Guy</p>