0

After trying couple of ways to install with HomeBrew and RVM I still cannot install gem pg

I used all Stackoverflow answered questions, but they did not help me at all.

I am using Postgresql app

My question is what I am doing wrong? I did not created a user for PG because main problem is that I cannot install PG on my Mac

$ sudo gem install pg -v '0.19.0'
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
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 ***
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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
    --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}/
    --with-pqlib
    --without-pqlib
    --with-libpqlib
    --without-libpqlib
    --with-ms/libpqlib
    --without-ms/libpqlib


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/pg-0.19.0 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/pg-0.19.0/ext/gem_make.out
GYTO
  • 440
  • 1
  • 10
  • 23
  • What solutions have you tried? It might help knowing what didn't work and what the results of those attempts were... I've had similar issues with `pg` with an error that worked almost exactly like that. – Antonio Nov 05 '16 at 21:44
  • @Antonio I tried this and rvm commands too brew uninstall postgresql brew install postgresql gem install pg – GYTO Nov 05 '16 at 21:51
  • Have you tried reinstalling XCode from scratch? I believe that is what got me past this hump in the past when I upgraded to El Capitan a while back. http://stackoverflow.com/questions/19262312/installing-pg-gem-on-os-x-failure-to-build-native-extension – Antonio Nov 05 '16 at 21:52
  • @Antonio My mac fresh. Clean reinstall from this morning – GYTO Nov 05 '16 at 21:53

1 Answers1

0

It says it can't find the postgreSQL client library.

Have a look at this answer. It's output in this question is, from what I can see, line for line the same one you're having.

Can't find the PostgreSQL client library (libpq)

Community
  • 1
  • 1
Antonio
  • 731
  • 7
  • 28
  • @GYTO, Can you mark it as the correct answer? So, if someone else have a similar problem and comes across this question, they will have an idea of what works. – Antonio Nov 05 '16 at 22:02
  • @Antonia sorry I was busy, now is solved, thanks again – GYTO Nov 06 '16 at 05:13