Postgresql Gem Pg Was Unable to Install

PostgreSQL gem pg was unable to install

I got the same error on Centos. By googling I found two commands to use:

  1. yum install postgresql-libs -- It gave me message saying, its already installed.
  2. yum install postgresql-devel -- It solved my error related to pg_config for installing the 'pg' .gem.

Hope it helps :)

apos wrote: on Ubuntu 14.04 install:

  1. apt-get install postgresql-server-dev-9.3 libpq-dev

unable to install pg gem

Answered here:
Can't install pg gem on Windows

There is no Windows native version of
latest release of pg (0.10.0) released
yesterday, but if you install 0.9.0 it
should install binaries without
issues.

Can't install pg gem on Windows

The message you're getting is a clear indication that you lack something for the correct installation of that gem:

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.

There is no Windows native version of latest release of pg (0.10.0) released yesterday, but if you install 0.9.0 it should install binaries without issues.

Anyhow, if you want to install the gem, you need a build environment installed. If you're using RubyInstaller, then you need the DevKit

Installation of the gem will only require you provide additional options to gem installation (like --with-pg-dir)

subst X: "C:\Program Files (x86)\PostgreSQL\8.3"
gem install pg -- --with-pg-dir=X:
subst X: /D

Can't install pg gem on Rails

You need to configure pg correctly.

Run:

bundle config build.pg --with-pg-config=/Applications/Postgres.app/Contents/Versions/(YOUR POSTGRES VERSION)/bin/pg_config

Then try to run bundle:

bundle install

Windows: Installing pg gem fail with Can't find the PostgreSQL client library (libpq) and undefined reference to `PQconnectdb'

The issue was apparently being caused because I was using the 32 bit version of Ruby. Installed the 64 bit and the issue was resolved.

Rails pg gem, an error occurred while installing pg

I guess you don't have postgres installed in your system. You could either install postgresql via homebrew/macports or disable the installation of production gems with:

bundle install --without production


Related Topics



Leave a reply



Submit