An error occurred while installing pg (1.0.0), and Bundler cannot continue
I have an issue with the bundle install and cannot complete the installation.
What can I do to finish the bundle?
find_executable: checking for pg_config... -------------------- no
--------------------
find_header: checking for libpq-fe.h... -------------------- no
"clang -o conftest -I/Users/leotyndall/.rbenv/versions/2.4.2/include/ruby-2.4.0/x86_64-darwin17 -I/Users/leotyndall/.rbenv/versions/2.4.2/include/ruby-2.4.0/ruby/backward -I/Users/leotyndall/.rbenv/versions/2.4.2/include/ruby-2.4.0 -I. -I/Users/leotyndall/.rbenv/versions/2.4.2/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -pipe conftest.c -L. -L/Users/leotyndall/.rbenv/versions/2.4.2/lib -L. -L/Users/leotyndall/.rbenv/versions/2.4.2/lib -fstack-protector -L/usr/local/lib -lruby-static -framework CoreFoundation -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/leotyndall/.rbenv/versions/2.4.2/include/ruby-2.4.0/x86_64-darwin17 -
I/Users/leotyndall/.rbenv/versions/2.4.2/include/ruby-
2.4.0/ruby/backward -
I/Users/leotyndall/.rbenv/versions/2.4.2/include/ruby-2.4.0 -I. -
I/Users/leotyndall/.rbenv/versions/2.4.2/include -D_XOPEN_SOURCE -
D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-
error=shorten-64-to-32 -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 */
--------------------
extconf failed, exit code 1
An error occurred while installing pg (1.0.0), and Bundler cannot continue.
Make sure that `gem install pg -v '1.0.0'` succeeds before bundling.
* libpq-fe.h. * This file contains definitions for structures and. * externs for functions used by frontend postgres applications. *
Libpq is included in the full PostgreSQL source code. You can use just libpq without the rest of PostgreSQL, but must download the full package. You can download it from the PostgreSQL Downloads page.
Try installing libpq-dev
or its equivalent for your OS:
sudo apt-get install libpq-dev
yum install postgresql-devel
brew install postgresql
gem install pg -- --with-pg-config=/opt/local/lib/postgresql[version number]/bin/pg_config
zypper in postgresql-devel
For macos, the above answers did not work or were not practical for me. I didn't want to install all of postgres.
$ brew install libpq
$ bundle config --local build.pg --with-opt-dir="/usr/local/opt/libpq"
$ bundle install
Reference: https://michaelrigart.be/install-pg-ruby-gem-without-postgresql/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With