I have tried following this answer to get the gem to work, but it wont. I have my projects set up such that individuals projects have there own gems instead of all themes gems living in global space, and then I use binstubs
to allow me to do things like bin/rails
.
So all gems are installed to .bundle/gems/
for each project. the one that always gives me the toughest problems is posgresql. Lets go through the steps.
So I run:
bundle
It explodes stating:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
Using config values from /Applications/Postgres.app/Contents/Versions/9.3/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
--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 /Users/Adam/Documents/Rails-Projects/AisisPlatform/.bundle/gems/gems/pg-0.18.1 for inspection.
Results logged to /Users/Adam/Documents/Rails-Projects/AisisPlatform/.bundle/gems/gems/pg-0.18.1/ext/gem_make.out
An error occurred while installing pg (0.18.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.1'` succeeds before bundling.
So then, because I have the home brew version installed at 9.4.0 and the posgresql.app installed I then did:
bundle config build.pg --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
Followed by, because I use 18.1
gem install pg -v '0.18.1'
And I got:
Building native extensions. This could take a while...
Successfully installed pg-0.18.1
invalid options: -f fivefish
(invalid options are ignored)
Parsing documentation for pg-0.18.1
Done installing documentation for pg after 2 seconds
1 gem installed
From there I tried bundle
Well we are back to square one because even though the gem installed - I get the EXACT same error.
Is this because I am installing the pg gem globally and not locally? How can I fix this? This one project, every time I have to do a rm -rf .bundle/gems
Causes this exact issue over and over again.
I should point out I get the same error even if I use the home brew psql pg_config
Do all the steps above, just with home brew version, same results.