Gem install pg does not work on OSX 10.9

when starting the installation of the package (or gem install pg) I get the following error: I already tried to fix the xcode command-line tools

/Users/josh/.rvm/rubies/ruby-2.0.0-p353/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. 
  • Ruby 2.0.0
  • Rails 4.0.2
  • OSX 10.9.1
+6
source share
3 answers

I had the same problem today and this answer solved this for me.

fooobar.com/questions/40015 / ...

Hope this helps.

Summary

brew update

brew install postgresql

install package

+9
source

For reference, @marcamillion code refers to:

 brew update brew install postgresql bundle install 
+5
source

I had the same problem. I changed Gemfile.lock and replaced pg (0.17.1) with pg (0.18.1) only.

Download PostgreSQL 9.4 and install on the system

use the following command to install pg now

 gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config 
+3
source

All Articles