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

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


Run 'bundle config' before 'bundle install' to set the parameters, i.e.:

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

with Rails3 and PostgreSQL. I do like this

>rails new test_app -d postgreSQL
>cd test_app
>mkdir .bundle
>echo "BUNDLE_BUILD__PG: --with-pg-config=/opt/local/lib/postgresql91/bin/pg_config" > .bundle/config
>bundle install

so you can keep config in source control.

for user's profile

bundle config build.pg --with-pg-config=/opt/local/lib/postgresql91/bin/pg_config

this will create ~/.bundle/config file.