0

Problems running bundle install and rails s will not load properly...have tried everything I could find on old Stackoverflow posts on similar issues to no avail.. error below.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20140930-556-1w549j8.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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/2.0/usr/bin/ruby
        --with-pg
        --without-pg
        --with-pg-config
        --without-pg-config
        --with-pg_config
        --without-pg_config
        --with-pg-dir
        --without-pg-dir
        --with-pg-include
        --without-pg-include=${pg-dir}/include
        --with-pg-lib
        --without-pg-lib=${pg-dir}/

extconf failed, exit code 1

Any help would be greatly appreciated!

Max
  • 15,157
  • 17
  • 82
  • 127
  • Please move the error from paste bin into your question. *WHEN* that link breaks your question will be of no use to future searchers looking for the answer to your question. Also, by putting it somewhere besides in your question, you're forcing anyone trying to help you to chase that down, which isn't a good thing to do as it discourages help. Make it easy for people to help you. – the Tin Man Sep 30 '14 at 21:48
  • Also, your problem is not OSX related honestly. You should remove that from the subject as people who use other development environments may not even think to look. As a quick question, did you run gem install pg separately? And then try bundle? – Art Sep 30 '14 at 22:44
  • 1
    possible duplicate of [Can't find the 'libpq-fe.h header when trying to install pg gem](http://stackoverflow.com/questions/6040583/cant-find-the-libpq-fe-h-header-when-trying-to-install-pg-gem) – Amadan Oct 01 '14 at 04:28
  • Technically, it is a duplicate of that question, but the accepted answer is old and out of date. – Max Oct 01 '14 at 04:46

1 Answers1

1

The problem is that you don't have pg installed. The first step is to install Postgres.

Do that here: http://postgresapp.com/

Next step is to install the pg gem with the required config files. Do that like this:

gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config

You might have to change the path a bit to point to the right place.

Max
  • 15,157
  • 17
  • 82
  • 127