Gem Install PG mysterious error extconf.rb related

I am trying to update my pg gem and I am getting the following error

Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

        /Users/larson/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb --with-pg-config=/Library/PostgreSQL/9.1/bin/pg_config
Using config values from /Library/PostgreSQL/9.1/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.

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/larson/.rvm/rubies/ruby-1.9.2-p290/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
/Users/larson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/larson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
    from /Users/larson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:853:in `block in find_header'
    from /Users/larson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
    from /Users/larson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
    from /Users/larson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/larson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
    from /Users/larson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/larson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
    from /Users/larson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
    from /Users/larson/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:852:in `find_header'
    from extconf.rb:40:in `<main>'


Gem files will remain installed in /Users/larson/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.13.2 for inspection.
Results logged to /Users/larson/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.13.2/ext/gem_make.out

      

I tried looking for the mkmf.log file and couldn't find it. I tried several approaches including placing the directory of the pg_conf file, but nothing worked so far. I am trying to do this on 10.6.8. snow leopard and my ruby ​​- 1.9.2-p290. I have pg 9.1 installed.

I've tried this:

gem install pg

gem install pg - --with-pg-config = / usr / local / bin / pg_config

This issue came after I replaced my macbook pro hard drive and restored the system via time machine. Do I have to reinstall Xcode? Any other suggestions?

+3


source to share


1 answer


I had a similar problem. I got around it by updating rvm:



rvm get latest
rvm reload
rvm --force install 1.9.2

      

+8


source







All Articles