Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Problema no bundle install da gem 'pg'

Quando tento rodar bundle install aparece a seguinte mensagem

Fetching pg 1.2.2
Installing pg 1.2.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/Users/marco/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pg-1.2.2/ext
/Users/marco/.rbenv/versions/2.5.1/bin/ruby -r
./siteconf20200306-18899-n0zgwe.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
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.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/marco/.rbenv/versions/2.5.1/bin/$(RUBY_BASE_NAME)
    --with-pg
    --without-pg
    --enable-windows-cross
    --disable-windows-cross
    --with-pg-config
    --without-pg-config
    --with-pg_config
    --without-pg_config
    --with-pg-dir
    --without-pg-dir
    --with-pg-include
    --without-pg-include=${pg-dir}/include
    --with-pg-lib
    --without-pg-lib=${pg-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/Users/marco/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-17/2.5.0/pg-1.2.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/Users/marco/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pg-1.2.2 for
inspection.
Results logged to
/Users/marco/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-17/2.5.0/pg-1.2.2/gem_make.out

An error occurred while installing pg (1.2.2), and Bundler cannot
continue.
Make sure that `gem install pg -v '1.2.2' --source 'https://rubygems.org/'`
succeeds before bundling.

In Gemfile:
  pg

E o arquivo mkmf.log gerado é o seguinte:

find_executable: checking for pg_config... -------------------- no

--------------------

find_header: checking for libpq-fe.h... -------------------- no

"clang -o conftest -I/Users/marco/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-darwin17 -I/Users/marco/.rbenv/versions/2.5.1/include/ruby-2.5.0/ruby/backward -I/Users/marco/.rbenv/versions/2.5.1/include/ruby-2.5.0 -I. -I/Users/marco/.rbenv/versions/2.5.1/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -O3 -Wno-error=shorten-64-to-32  -fno-common -pipe conftest.c  -L. -L/Users/marco/.rbenv/versions/2.5.1/lib -L. -L/Users/marco/.rbenv/versions/2.5.1/lib  -fstack-protector -L/usr/local/lib     -lruby.2.5.1  -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"clang -E -I/Users/marco/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-darwin17 -I/Users/marco/.rbenv/versions/2.5.1/include/ruby-2.5.0/ruby/backward -I/Users/marco/.rbenv/versions/2.5.1/include/ruby-2.5.0 -I. -I/Users/marco/.rbenv/versions/2.5.1/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -O3 -Wno-error=shorten-64-to-32  -fno-common -pipe  conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'libpq-fe.h' file not found
#include <libpq-fe.h>
         ^~~~~~~~~~~~
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <libpq-fe.h>
/* end */

--------------------
1 resposta
solução!

Achei a solução. Era só instalar o postgresql através do "brew install postgresql"

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software