2
votes

I'm new to the world of programming and I'm having a bit of a time resolving a bundling error with ruby on rails. I'm running OSX 10.9.1, RVM for Ruby management, and I am using ruby 2.1.1.

The error I receive is:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /Users/Removed/.rvm/rubies/ruby-2.1.1/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. extconf failed, exit code 1

Gem files will remain installed in /Users/Removed/.rvm/gems/ruby-2.1.1/gems/pg-0.12.2 for inspection. Results logged to /Users/Removed/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-13/2.1.0/pg-0.12.2/gem_make.out An error occurred while installing pg (0.12.2), and Bundler cannot continue.

After a little research I downloaded the Postgres App and put it into the Application directory. It appears I am still having a header problem as well, so I tried try specifying the include directory of the app. Still no resolution. Iv'e also came across some material relating to homebrew,but I'm at a loss for getting set up here. If I could have some help getting sorted out it would be greatly appreciated. Thank you in advance.

Edit:

rvm info :

ruby-2.1.1:

system: uname: "Darwin christohersmini 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64" system: "osx/10.9/x86_64" bash: "/bin/bash => GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13)" zsh: "/bin/zsh => zsh 5.0.2 (x86_64-apple-darwin13.0)"

rvm: version: "rvm 1.25.19 (stable) by Wayne E. Seguin , Michal Papis [https://rvm.io/]" updated: "35 minutes 14 seconds ago" path: "/Users/christopherwhittemore/.rvm"

ruby: interpreter: "ruby" version: "2.1.1p76" date: "2014-02-24" platform: "x86_64-darwin13.0" patchlevel: "2014-02-24 revision 45161" full_version: "ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]"

Checking to see if I'm in a subdirectory was a good idea, but sadly I'm not. I'm just trying to boot the server from the root directory of the application.

1
Maybe you accidentally created a new gem set for that directory? Can you run bundle install in the directory? What do you get if you run rails -v in that directory?Beartech

1 Answers

1
votes

Try doing what it says:

--with-pg-config=/path/to/pg_config

so re-run the install command like:

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

This is assuming you have the Postgres app in your Applications folder. You will run into other issues with Postgres.app, but it's worth it to work through them. Every "App" in OS X is really just a folder that you can look into. If you right click on the app and choose "show contents" you will get a new window that will let you browse the content of the app folder.