Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I pass a parameter for gem installation when I run bundle install?

I added the pg gem to my gemfile

gem 'pg' 

When I run bundle install, I get this error:

Installing pg (0.10.1) with native extensions /Users/ben/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)  /Users/benhartney/.rvm/rubies/ruby-1.9.2-p0/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. 

It seems I need to pass in this config parameter

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

How can I do this when I use bundle install?

like image 845
ben Avatar asked Mar 02 '11 13:03

ben


People also ask

What happens when you run bundle install?

When you make a change to the Gemfile(5) and then run bundle install , Bundler will update only the gems that you modified. In other words, if a gem that you did not modify worked before you called bundle install , it will continue to use the exact same versions of all dependencies as it used before the update.

How do I fix a run bundle to install missing gems?

In the invoked popup, start typing bundler, select bundle install and press Enter . Select Tools | Bundler | Install from the main menu. Open the Gemfile, place the caret at any highlighted gem missing in the project SDK and press Alt+Enter . Select Install missing gems using 'bundler' and press Enter .

What is the difference between bundle install and bundle update?

The most common question I've heard about Bundler is about the difference between bundle install and bundle update . In a nutshell: bundle install handles changes to the Gemfile and bundle update upgrades gems that are already managed by Bundler.


1 Answers

You need to set a build config option like so:

bundle config build.pg --with-pg-config=/path/to/pg_config 

More info can be found in the bundle config man page

like image 57
idlefingers Avatar answered Oct 20 '22 17:10

idlefingers