Unable to Install Pg Gem

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

Rails - Gem Error while installing pg (1.1.3), and Bundler cannot continue

try instaling with pg-config like this:

gem install pg -v 1.1.3 -- --with-pg-config=/usr/pgsql-9.X/bin/pg_config.

In pg-config path mention the posgtres version installed in you're system.

Could not find gem 'pg x64-mingw32' in locally installed gems

This happens, if pg gem is installed with a dedicated PostgreSQL installation. they will update the pg gem soon to fix this and to distribute ruby-3.0 compatible binary gems, but until then there are 3 workarounds:

 1. install postgresql per pacman: ridk exec pacman -S
mingw-w64-x86_64-postgresql and reinstall pg gem
2. Set RUBY_DLL_PATH=<your-path-to-postgresql>/bin as in our CI (https://github.com/ged/ruby-pg/blob/4de2c7df34b23a23841b114ae6606161be44d269/appveyor.yml#L22) before
running the ruby app.
3. Downgrade to ruby < 3.0, since that installs
the binary windows gems instead.

For more info check Github issue.



Related Topics



Leave a reply



Submit