Note that there are some explanatory texts on larger screens.

plurals
  1. POpg gem can't find native extensions -- PostgreSQL installed using Homebrew
    primarykey
    data
    text
    <p>I'm on Mac OS X 10.8.2, which I reinstalled a few hours ago in frustration with the issues that follow.</p> <p>I have installed Homebrew, and when I run <code>brew doctor</code>, it says <code>Your system is raring to brew</code>.</p> <p>I have the latest Xcode with the command-line utilities.</p> <p>I have installed PostgreSQL using Homebrew.</p> <pre><code>steven$ ls /usr/local/Cellar/postgresql/9.2.1 COPYRIGHT README homebrew.mxcl.postgresql.plist lib INSTALL_RECEIPT.json bin include share steven$ psql --version psql (PostgreSQL) 9.2.1 iMac-001EC20A3C44-5:9.2.1 steven$ which psql /usr/local/bin/psql </code></pre> <p>I have a Rail app with <code>gem 'pg'</code> in its Gemfile, but I can't install the gem:</p> <pre><code>steven$ bundle install Fetching source index for http://rubygems.org/ Installing pg (0.14.1) with native extensions /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/installer.rb:482:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-pg-config=/usr/pgsql-9.1/bin/pg_config Using config values from /usr/pgsql-9.1/bin/pg_config sh: /usr/pgsql-9.1/bin/pg_config: No such file or directory sh: /usr/pgsql-9.1/bin/pg_config: No such file or directory 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. </code></pre> <p>It seems to be looking for pg_config and libpq, which are easy enough to find:</p> <pre><code>steven$ ls /usr/local/Cellar/postgresql/9.2.1/bin ... pg_config ... steven$ ls /usr/local/Cellar/postgresql/9.2.1/include ... libpq ... </code></pre> <p>So I've tried passing every configuration option I can think of, but none work:</p> <pre><code>steven$ sudo gem install pg -- --with-pg-config="/usr/local/Cellar/postgresql/9.2.1/bin" Password: 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/1.8/usr/bin/ruby extconf.rb --with-pg-config=/usr/local/Cellar/postgresql/9.2.1/bin Using config values from /usr/local/Cellar/postgresql/9.2.1/bin sh: /usr/local/Cellar/postgresql/9.2.1/bin: is a directory sh: /usr/local/Cellar/postgresql/9.2.1/bin: is a directory 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/1.8/usr/bin/ruby --with-pg --without-pg --with-pg-dir --without-pg-dir --with-pg-include --without-pg-include=${pg-dir}/include --with-pg-lib --without-pg-lib=${pg-dir}/lib --with-pg-config --with-pqlib --without-pqlib --with-libpqlib --without-libpqlib --with-ms/libpqlib --without-ms/libpqlib steven$ sudo gem install pg -- --with-pg-config="/usr/local/Cellar/postgresql/9.2.1/bin" --with-libpqlib="/usr/local/Cellar/postgresql/9.2.1/include" Password: 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/1.8/usr/bin/ruby extconf.rb --with-pg-config=/usr/local/Cellar/postgresql/9.2.1/bin --with-libpqlib=/usr/local/Cellar/postgresql/9.2.1/include Using config values from /usr/local/Cellar/postgresql/9.2.1/bin sh: /usr/local/Cellar/postgresql/9.2.1/bin: is a directory sh: /usr/local/Cellar/postgresql/9.2.1/bin: is a directory 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 -l/usr/local/Cellar/postgresql/9.2.1/include... 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/1.8/usr/bin/ruby --with-pg --without-pg --with-pg-dir --without-pg-dir --with-pg-include --without-pg-include=${pg-dir}/include --with-pg-lib --without-pg-lib=${pg-dir}/lib --with-pg-config --with-pqlib --without-pqlib --with-libpqlib --with-ms/libpqlib --without-ms/libpqlib steven$ sudo gem install pg --with-pg-config="/usr/local/Cellar/postgresql/9.2.1/bin" --with-libpqlib="/usr/local/Cellar/postgresql/9.2.1/include" ERROR: While executing gem ... (OptionParser::InvalidOption) invalid option: --with-pg-config=/usr/local/Cellar/postgresql/9.2.1/bin steven$ sudo gem install pg --with-pg-config="/usr/local/Cellar/postgresql/9.2.1/bin/" --with-libpqlib="/usr/local/Cellar/postgresql/9.2.1/include/" ERROR: While executing gem ... (OptionParser::InvalidOption) invalid option: --with-pg-config=/usr/local/Cellar/postgresql/9.2.1/bin/ steven$ sudo gem install pg --with-pg-config='/usr/local/Cellar/postgresql/9.2.1/bin/' --with-libpqlib='/usr/local/Cellar/postgresql/9.2.1/include/' ERROR: While executing gem ... (OptionParser::InvalidOption) invalid option: --with-pg-config=/usr/local/Cellar/postgresql/9.2.1/bin/ steven$ sudo gem install pg -- --with-pg-config='/usr/local/Cellar/postgresql/9.2.1/bin/' --with-libpqlib='/usr/local/Cellar/postgresql/9.2.1/include/' 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/1.8/usr/bin/ruby extconf.rb --with-pg-config=/usr/local/Cellar/postgresql/9.2.1/bin/ --with-libpqlib=/usr/local/Cellar/postgresql/9.2.1/include/ Using config values from /usr/local/Cellar/postgresql/9.2.1/bin/ sh: /usr/local/Cellar/postgresql/9.2.1/bin/: is a directory sh: /usr/local/Cellar/postgresql/9.2.1/bin/: is a directory 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 -l/usr/local/Cellar/postgresql/9.2.1/include/... 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/1.8/usr/bin/ruby --with-pg --without-pg --with-pg-dir --without-pg-dir --with-pg-include --without-pg-include=${pg-dir}/include --with-pg-lib --without-pg-lib=${pg-dir}/lib --with-pg-config --with-pqlib --without-pqlib --with-libpqlib --with-ms/libpqlib --without-ms/libpqlib steven$ sudo gem install pg --with-pg-config=/usr/local/Cellar/postgresql/9.2.1/bin/ --with-libpqlib=/usr/local/Cellar/postgresql/9.2.1/include ERROR: While executing gem ... (OptionParser::InvalidOption) invalid option: --with-pg-config=/usr/local/Cellar/postgresql/9.2.1/bin/ iMac-001EC20A3C44-5:testivate steven$ sudo gem install pg --with-pg-config=/usr/local/Cellar/postgresql/9.2.1/bin/pg_config ERROR: While executing gem ... (OptionParser::InvalidOption) invalid option: --with-pg-config=/usr/local/Cellar/postgresql/9.2.1/bin/pg_config </code></pre> <p>What should I do?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload