Hello.
I'm with difficulty to install pg gem in my new MacBook Pro M1 (Apple Silicon).
I installed postgresql with homebrew and it's running successfully.
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /Users/tim/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pg-1.2.3/ext
/Users/tim/.rbenv/versions/2.7.1/bin/ruby -I /Users/tim/.rbenv/versions/2.7.1/lib/ruby/2.7.0 -r ./siteconf20210104-15657-13x7wqv.rb extconf.rb
checking for pg_config... yes
Using config values from /opt/homebrew/opt/libpq/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=/Users/tim/.rbenv/versions/2.7.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=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pq-dir
--without-pq-dir
--with-pq-include
--without-pq-include=${pq-dir}/include
--with-pq-lib
--without-pq-lib=${pq-dir}/lib
--with-pqlib
--without-pqlib
--with-libpq-dir
--without-libpq-dir
--with-libpq-include
--without-libpq-include=${libpq-dir}/include
--with-libpq-lib
--without-libpq-lib=${libpq-dir}/lib
--with-libpqlib
--without-libpqlib
--with-ms/libpq-dir
--without-ms/libpq-dir
--with-ms/libpq-include
--without-ms/libpq-include=${ms/libpq-dir}/include
--with-ms/libpq-lib
--without-ms/libpq-lib=${ms/libpq-dir}/lib
--with-ms/libpqlib
--without-ms/libpqlib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/tim/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-darwin-20/2.7.0/pg-1.2.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/tim/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pg-1.2.3 for inspection.
Results logged to /Users/tim/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-darwin-20/2.7.0/pg-1.2.3/gem_make.out