1

I think this is a common problem, however the solutions I've found on the internet are not working for me. When I run bundle install with this section in my gemfile

group :production, :staging do
  gem "pg"
end

group :development, :test do
  gem "sqlite3-ruby", :require => "sqlite3"
end

I get the following error

creating Makefile

make
compiling gvl_wrappers.c
compiling pg.c
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


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p194/gems/pg-0.16.0 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/gems/pg-0.16.0/ext/gem_make.out

Next step, according to what I've found, is to run locate pg_config, then place the location after the gem install pgcommand line statement. However, I get this error instead:

WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.

I then run the sudo command, and get this final error....

launchctl: Couldn't stat("/System/Library/LaunchDaemons/com.apple.locate.plis"): No such file or directory
nothing found to load

This is my first attempt at using this technology, brand new to Mac as well. Any help would be appreciated. Thanks!

EDIT

I am trying to follow the suggestions located here regarding this error.

2
  • it's a .plist file, not .plis - You can use mdfind instead of locate on a mac. mdfind uses the mac os x spotlight database of files Commented Aug 22, 2013 at 3:40
  • Was able to track down the location of the pg_config file (/usr/bin/pg_config), however after adding this to the gem install statement still received the same error. Commented Aug 22, 2013 at 3:56

1 Answer 1

1

It looks like despite what your gemfile says, you're trying to install postgres locally?

Really, that's what you should be doing. It's really non-optimal to use a different database in production to the one you use locally. I highly suggest just using Postgres everywhere, and remove sqlite.

On a Mac, the easiest route to this nirvana is to install Postgress.app

Sign up to request clarification or add additional context in comments.

3 Comments

Ok so.. I installed the Postgress.app from the link. Then ran all the commands from above (bundle install, locate pg.., etc) again and received the same error messages.
Hmm weird. If you run it again, I'm going to guess that while installing the pg gem it's going to finish with something like "/usr/local/rvm/gems/ruby-1.9.3-p194/gems/pg-0.16.0/ext/foobar.out". If it does, paste the output of foorbar.out here too..
By the way, the gist you point to suggests trying with 0.15.1. I never had any problem with Ruby 2 and the pg gem - and I see I'm using 0.15.1. Can you try changing your Gemfile so that it has the line gem 'pg', '~> 0.15.1' - save, and do a bundle install, and see what happens?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.