Sudo Gem Install Pg Won't Work

sudo gem install pg won't work

You need to install your distro ruby-dev (or devel) package otherwise you won~t be able to build any ruby C extensions.

I'm not on ubuntu, but you package-manager command might be somewhat like this:

$ sudo apt-get install ruby-dev build-essential

Rails 3 - can't install pg gem

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.

gem install pg not working while doing bundle install / RoR

What worked for me was running:

brew doctor

I then had to chown a few files and delete a few things it asked me to.

I then ran

sudo gem install pg

and it worked. Not sure why it only worked with 'sudo' but when I tried before without it failed

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

gem install pg won't bundle

make: /usr/bin/mkdir: Command not found it's the reason.

Please write this command with sudo perm.

sudo ln -s $(which mkdir) /usr/bin/mkdir

And try again bundle.

Rails: Installing PG gem on OS X - failure to build native extension

Same error for me and I didn't experience it until I downloaded OS X 10.9 (Mavericks). Sigh, another OS upgrade headache.

Here's how I fixed it (with homebrew):

  • Install another build of Xcode Tools (typing brew update in the terminal will prompt you to update the Xcode build tools)
  • brew update
  • brew install postgresql

After that gem install pg worked for me.

Impossible to Install PG gem on my mac with Mavericks

If you want to avoid using MacPorts, you can download the Postgres App and place it into the Application directory.

Then, specify the location of newly downloaded pg_config:

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

If you run in to missing headers problem, try specifying the include directory of the app:

gem install pg -- --with-pg-include='/Applications/Postgres.app/Contents/Versions/latest/include/'

gem install pg --with-pg-config works, bundle fails

Have you tried running this before running bundle install?

bundle config build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config

See http://bundler.io/v1.3/bundle_config.html



Related Topics



Leave a reply



Submit