Error installing Gem pg

Asked

Viewed 3,115 times

1

I’m making that mistake when I turn the bundle install

"An error occurred while Installing pg (0.21.0), and Bundler cannot continue. Make sure that `Gem install pg -v '0.21.0'` succeeds before bundling. In Gemfile:"

This is the Gem in my Gemfile: "gem 'pg', '~> 0.18'"

I tried to spin gem install pg -v '0.21.0' and then bundle install and I get

To see Why this Extension failed to Compile, Please check the mkmf.log which can be found here: /Library/Ruby/Gems/2.3.0/Extensions/universal-Darwin-17/2.3. 0/pg-0.21.0/mkmf.log extconf failed, Exit code 1 Gem files will remain installed in /Library/Ruby/Gems/2.3.0/Gems/pg-0.21.0 for Inspection. Results logged to /Library/Ruby/Gems/2.3.0/Extensions/universal-Darwin-17/2.3. 0/pg-0.21.0/gem_make . oct

mkmf.log:

error running Bundle install:::Fetching pg 0.21.0
Installing pg 0.21.0 with Native Extensions
Gem::Ext::Builderror: ERROR: Failed to build Gem Native Extension.

current directory: 
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***

2 answers

2

You need to install pg admin server on your machine first.

sudo apt-get install postgresql postgresql-contrib libpq-dev
  • opa, good afternoon...I already own the Pgadmin4 and even so the error continues

  • I already had Pg installed, but I installed the packages: postgresql-contrib libpq-dev and now it works, thanks.

  • On Ubuntu 20.04, only the libpq-dev package is required

0

Thank you. You’ve been very helpful. I was just executing sudo apt-get install postgresql postgresql-contrib libpq-dev and then bundle install

Browser other questions tagged

You are not signed in. Login or sign up in order to post.