When installing the pg gem on Ruby 2.0 I ran into the following issues:
pg.c: In function ‘pg_s_library_version’: pg.c:272: warning: implicit declaration of function ‘PQlibVersion’ pg.c: In function ‘Init_pg_ext’: pg.c:375: error: ‘PQPING_OK’ undeclared (first use in this function) pg.c:375: error: (Each undeclared identifier is reported only once pg.c:375: error: for each function it appears in.) pg.c:377: error: ‘PQPING_REJECT’ undeclared (first use in this function) pg.c:379: error: ‘PQPING_NO_RESPONSE’ undeclared (first use in this function) pg.c:381: error: ‘PQPING_NO_ATTEMPT’ undeclared (first use in this function) make: *** [pg.o] Error 1
To solve this:
- Find the binary (mine is /usr/local/bin/pg_config)
- gem install pg -v '0.16.0' -- with-pg-config=/usr/local/bin/pg_config
UPDATE #1: If this still fails with pg version 0.16.0, then downgrade to version 0.15.1 and it should work. Add the following to your Gemfile:
gem 'pg', '~> 0.15.1'
UPDATE #2: When I really came to need version 0.16.0, I simply re-installed postgresql via homebrew (updating homebrew was probably what broke everything in the first place)