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
Can't find the 'libpq-fe.h header when trying to install pg gem
It looks like in Ubuntu that header is part of the libpq-dev
package (at least in the following Ubuntu versions:
11.04 (Natty Narwhal), 10.04 (Lucid Lynx), 11.10 (Oneiric Ocelot), 12.04 (Precise Pangolin), 14.04 (Trusty Tahr) and 18.04 (Bionic Beaver)):
...
/usr/include/postgresql/libpq-fe.h
...
So try installing libpq-dev
or its equivalent for your OS:
- For Ubuntu/Debian systems:
sudo apt-get install libpq-dev
- On Red Hat Linux (RHEL) systems:
yum install postgresql-devel
- For Mac Homebrew:
brew install postgresql
- For Mac MacPorts PostgreSQL:
gem install pg -- --with-pg-config=/opt/local/lib/postgresql[version number]/bin/pg_config
- For OpenSuse:
zypper in postgresql-devel
- For ArchLinux:
pacman -S postgresql-libs
Related Topics
Restarting a Loop from the Top
Understanding the Rails Authenticity Token
Ruby Block and Unparenthesized Arguments
What's the Difference Between Ruby'S Dup and Clone Methods
No Such File to Load - Rubygems (Loaderror)
Using Sinatra For Larger Projects Via Multiple Files
Gem Installation Error: You Have to Install Development Tools First (Windows)
Why Are We Installing Ruby 1.9.2/1.9.3 Gems into a 1.9.1 Folder
Cannot Load Such File - Script/Rails: Getting This Error While Remote Debugging Through Rubymine
Find Out If Current Time Is Between Two Times
How to Call Methods Dynamically Based on Their Name
How to Generate a Random String in Ruby
Ruby - Parameters by Reference or by Value
Why Does String Interpolation Work in Ruby When There Are No Curly Braces
Is There a Clean Way to Avoid Calling a Method on Nil in a Nested Params Hash