0

I ran bundle update (so that I can install rails), but got this error:

$ bundle update
..... < other stuff ....>
Installing pg (0.14.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/user/.rvm/rubies/ruby-1.9.3-p374/bin/ruby 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.

I'm new to Ruby and all this, could anyone tell me what is wrong here? This is on OSX

user1508893
  • 9,223
  • 14
  • 45
  • 57

1 Answers1

2

Make sure ton install postgres first. I suggest you do so via homebrew, the Mac package manager.

brew install postgresql

Here is one of the many tutorials on how-to install postgres on a Mac.

EDIT

Looks like the gem can't find your postgres config, here's an answer similar to your problem:

https://stackoverflow.com/a/9669523/277370

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
allaire
  • 5,995
  • 3
  • 41
  • 56
  • `postgres` as in `posgresSQL`? I do have PSQL on my machine, if that is what you're asking? – user1508893 Feb 13 '13 at 19:05
  • are you able to run psql or createuser commands in your terminal? – allaire Feb 13 '13 at 19:06
  • Well, I have the PSQL interface (to talk to other database server, not necessarily the PSQL server). And `psql` is in my path. So I can type `psql` fromt the terminal without getting `command not found` – user1508893 Feb 13 '13 at 19:07
  • Ok, so I found the `pg_config` file (in `/usr/local/pgsql-9.1/bin/`, and ran `gem install pg -- ...`, that should resolve the problem? ANything else I should try? – user1508893 Feb 13 '13 at 19:16
  • Just make sure to accept this answer if it was of any help, that's about it. – allaire Feb 13 '13 at 19:55
  • Yes, your answer and the answers in the link help. Thanks. – user1508893 Feb 13 '13 at 19:58