Rails 3 - can't install pg gem Rails 3 - can't install pg gem ruby-on-rails ruby-on-rails

Rails 3 - can't install pg gem


if you are running on Linux you may be interested in what worked for me:

sudo apt-get install postgresqlsudo apt-get install libpq-dev

Then

gem install pg

then

bundle install

src: http://wikimatze.de/installing-postgresql-gem-under-ubuntu-and-mac


As stated in your error log you need to pass in the path to the pg_config. Try to install the gem using:

gem install pg -- --with-pg-config= 'PATH_TO_YOUR_PG_CONFIG'

If you are not sure where your pg_config is, and assuming you are on Linux or Mac, you can run the following command:

which pg_config

Your pg-config can be in different locations depending on how you installed postgres.


If you're using Postgress.app then youll want access to its command-line tools. Enter the following line in your terminal or your PATH profile:

 PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"

gem install pg should now work. (This is what worked for me.)

Note New versions path looks like:

/Applications/Postgres.app/Contents/Versions/<version>/bin