Can't find the PostgreSQL client library (libpq)
Solution: reinstalled PostgreSQL with Homebrew.
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.
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
I can't install pg in Slackware
I've just realised that Slackware uses slackpkg
as package manager.
Not quite sure if this is the library you need, but try installing with:
slackpkg install libpqxx
Related Topics
Ruby Regexp Group Matching, Assign Variables on 1 Line
Rails: Should Partials Be Aware of Instance Variables
Devise Logged in Root Route Rails 3
Rails Resque Workers Fail with Pgerror: Server Closed the Connection Unexpectedly
Magic First and Last Indicator in a Loop in Ruby/Rails
How to Serve Requests Concurrently with Rails 4
Using Factory_Girl in Rails with Associations That Have Unique Constraints. Getting Duplicate Errors
Rails Hidden Field Undefined Method 'Merge' Error
How to Get the Name of the Command Called for Usage Prompts in Ruby
Ruby on Rails "Invalid Byte Sequence in Utf-8" Due to Bot
Routing Nested Resources in Rails 3
Open the Default Browser in Ruby
Error Installing Nokogiri on Bundle Install But Already Installed
What Are the Differences Between "Private", "Public", and "Protected Methods"
How to Install JSON Gem - Failed to Build Gem Native Extension(MAC 10.10)