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
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.
Error Installing PG Gem on Windows
As a follow-up to the comments, it looks like you've got to use 32-bit
Postgres on Windows.
This is most likely to do with the idea that the pg
gem works with mingw32
, although I'm not totally sure
PostgreSQL gem pg was unable to install
I got the same error on Centos. By googling I found two commands to use:
yum install postgresql-libs
-- It gave me message saying, its already installed.yum install postgresql-devel
-- It solved my error related topg_config
for installing the 'pg' .gem.
Hope it helps :)
apos wrote: on Ubuntu 14.04 install:
apt-get install postgresql-server-dev-9.3 libpq-dev
pg gem installation is giving error in Redhat
You first need to install build tools (i.e. a C compiler and related tools) as well as development headers for your postgres server to be able to compile the gem.
For RedHat, you should be able to get all required tools with
yum install autoconf bison flex gcc gcc-c++ gettext kernel-devel make m4 ncurses-devel patch
yum install postgresql-devel
With Chef 14, you can use the built-in build_essential
resource to install the required compiler packages. On older versions, you can use the build-essential
cookbook.
Why isn't bundle install allowing for the pg gem to fully install?
The trick was to install the pg gem under the correct pathway to pg_config whereas before it wasn't fully installed.
I ran gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
after locating the pg_config exec file. I just had to locate my pg_config file and run gem install under that pathway.
Related Topics
How to Return a Part of an Array in Ruby
Why Is Sum So Much Faster Than Inject(:+)
Change the Name of the :Id Parameter in Routing Resources for Rails
How to Match Accented Characters With a Regex
Reading the Last N Lines of a File in Ruby
List of Ruby Operators That Can Be Overridden/Implemented
How to Write Postgresql Functions on Ruby on Rails
Set Global Default Encoding For Ruby 1.9
Using Layouts in Haml Files Independently of Rails
Unzip (Zip, Tar, Tag.Gz) Files With Ruby
In Ruby, Is There an Array Method That Combines 'Select' and 'Map'
Extract Number from String in Ruby
In Rails, How to Add a New Method to String Class
How to Understand the Difference Between Class_Eval() and Instance_Eval()