title: Error Installing pg gem and running server after leopard to lion upgrade
body: <p>Used a time machine backup to sync files from my macbook running Leopard to my macbook pro running Lion.  After having trouble pushing to heroku due to the fact that I was running sqlite3, I went down a rabbit hole in trying to get a pg gem installed. </p>
  
  <pre><code>gem install pg
  </code></pre>
  
  <p>yields:</p>
  
  <pre><code>        /Users/taylorjackson/.rvm/rubies/ruby-1.9.2-p136/bin/ruby extconf.rb 
  checking for pg_config... yes
  Using config values from /usr/local/bin/pg_config
  checking for libpq-fe.h... *** 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.
  </code></pre>
  
  <p>I'm a Unix noob and fear there's something deeply wrong with the file structure that was created by time machine in mashing up 32 bit leopard with 64 bit lion.  Steps I've taken so far. </p>
  
  <p>Reinstalled XCode</p>
  
  <pre><code>Xcode 4.3.3
  Build version 4E3002
  </code></pre>
  
  <p>Installed command line tools in XCode from preferences.</p>
  
  <p>updated to rvm 1.14.6 (master) with</p>
  
  <pre><code>rvm get head
  </code></pre>
  
  <p>Banged head against wall trying to install postgre locally with macports.  uninstalled macports and installed homebrew</p>
  
  <p>Followed recs from </p>
  
  <pre><code>brew doctor
  </code></pre>
  
  <p>then</p>
  
  <p>brew install postgresql</p>
  
  <p>ran into python issues and followed advice to install w/o python</p>
  
  <pre><code>brew install --no-python postgresql
  </code></pre>
  
  <p>seemed to get a clean install of postgresql, but my output from</p>
  
  <pre><code>gem install pg 
  </code></pre>
  
  <p>is still:</p>
  
  <pre><code>        /Users/taylorjackson/.rvm/rubies/ruby-1.9.2-p136/bin/ruby extconf.rb 
  checking for pg_config... yes
  Using config values from /usr/local/bin/pg_config
  checking for libpq-fe.h... *** 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.
  </code></pre>
  
  <p>Also tried</p>
  
  <pre><code>bundle install
  </code></pre>
  
  <p>and </p>
  
  <pre><code>bundle config build.pg --with-pg-config=/users/taylorjackson/postgresql/bin/pg_config
  bundle install
  </code></pre>
  
  <p>with the same results
  My productivity for the last 7 hours has dropped to nothing.  Can't find the relevant mkmf.log file.  Any other ideas? </p>
  
  <p>EDIT:</p>
  
  <p>found mkmf.log.  Here are relevant contents:</p>
  
  <pre><code>def have_devel?
    unless defined? $have_devel
      $have_devel = true
      $have_devel = try_link(MAIN_DOES_NOTHING)
    end
    $have_devel
  end
  
  def try_do(src, command, &amp;b)
    unless have_devel?
      raise &lt;&lt;MSG
  The complier failed to generate an executable file.
  You have to install development tools first.
  MSG
    end
    begin
      src = create_tmpsrc(src, &amp;b)
      xsystem(command)
    ensure
      log_src(src)
      rm_rf 'conftest.dSYM'
    end
  end
  </code></pre>