Error installing gem pg

0

I'm having this error while running bundle install

  

"An error occurred while installing pg (0.21.0), and Bundler can not 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 run 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 .out

mkmf.log:

  

error while 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 ***
    
asked by anonymous 05.12.2017 / 01:53

1 answer

1

You need to install admin pg before on your machine.

sudo apt-get install postgresql postgresql-contrib libpq-dev
    
07.12.2017 / 15:12