Can't install pg gem - ruby

I have the following problem when trying to install the pg gem. My OS is Ubuntu 12.10. I've already installed postgresql (via the installer from the postgres page). I've also done apt-get install of libpq5 and libpq-dev. This is the error:
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/home/sauronnikko/.rvm/rubies/ruby-1.9.3-p385/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/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
--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=/home/sauronnikko/.rvm/rubies/ruby-1.9.3-p385/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
--without-pg-config
--with-pg_config
--without-pg_config
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
Can you help me? Thanks

sudo apt-get install postgresql libpq-dev
then
bundle install
see this page:
Rails 3 - can't install pg gem

Related

Error installing pg Gem with 'bundle install'. Fails to build native extensions

When I run bundle install it gives:
Installing pg 0.18.4 with native extensions
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/latest/bin:/Users/ramishshahzad/.rbenv/shims:/Users/ramishshahzad/.rbenv/shims:/Applications/Postgres.app/Contents/Versions/9.5/bin:/Applications/Postgres.app/Contents/Versions/9.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin/sbin
Using config values from /Applications/Postgres.app/Contents/Versions/latest/bin:/Users/ramishshahzad/.rbenv/shims:/Users/ramishshahzad/.rbenv/shims:/Applications/Postgres.app/Contents/Versions/9.5/bin:/Applications/Postgres.app/Contents/Versions/9.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin/sbin
sh: /Applications/Postgres.app/Contents/Versions/latest/bin:/Users/ramishshahzad/.rbenv/shims:/Users/ramishshahzad/.rbenv/shims:/Applications/Postgres.app/Contents/Versions/9.5/bin:/Applications/Postgres.app/Contents/Versions/9.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin/sbin: No such file or directory
sh: /Applications/Postgres.app/Contents/Versions/latest/bin:/Users/ramishshahzad/.rbenv/shims:/Users/ramishshahzad/.rbenv/shims:/Applications/Postgres.app/Contents/Versions/9.5/bin:/Applications/Postgres.app/Contents/Versions/9.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin/sbin: 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.
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 /var/folders/6m/cn4bddqx4yz3jgl54hwccscc0000gn/T/bundler20160509-18530-6yu7yypg-0.18.4/gems/pg-0.18.4 for inspection.
Results logged to /var/folders/6m/cn4bddqx4yz3jgl54hwccscc0000gn/T/bundler20160509-18530-6yu7yypg-0.18.4/gems/pg-0.18.4/ext/gem_make.out
Using rack 1.6.4
Using tilt 2.0.1
Using bundler 1.11.2
Using tzinfo 1.2.2
Using ripl 0.7.1
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.
I've run gem install pg -v '0.18.4' and it installs successfuly:
But when I run 'bundle install' again, it gives the same error.
I have postgresql running and have run brew update as well, but still facing the error.

Cannot install Ruby gem libxslt-ruby on Mac cause it does not find libxml2

I've installed libxml2 and libxslt through Brew on my Mac but
gem install libxslt-ruby -- --with-xml2-dir=/usr/local/opt/libxml2 --with-xml2-lib=/usr/local/opt/libxml2/lib --with-xml2-include=/usr/local/opt/libxml2/include --with-xslt-include=/usr/local/opt/libxslt/include --version=1.1.1
or
gem install libxslt-ruby -- --with-xml2-dir=/usr/local/Cellar/libxml2/2.9.1 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --version=1.1.1
throws
Building native extensions. This could take a while...
/Users/gawlim/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/rubygems/ext/builder.rb:48: warning: Insecure world writable dir /usr/local/Cellar in PATH, mode 040777
ERROR: Error installing libxslt-ruby:
ERROR: Failed to build gem native extension.
/Users/gawlim/.rbenv/versions/1.9.3-p484/bin/ruby extconf.rb --with-xml2-dir=/usr/local/opt/libxml2 --with-xml2-lib=/usr/local/opt/libxml2/lib --with-xml2-include=/usr/local/opt/libxml2/include --with-xslt-include=/usr/local/opt/libxslt/include -v 1.0.8
checking for ruby/io.h... yes
checking for inflate() in -lz... yes
checking for iconv_open() in -liconv... yes
checking for xmlXPtrNewRange() in -lxml2... yes
checking for libxml/xmlversion.h... no
checking for libxml/xmlversion.h in /opt/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
*** 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/gawlim/.rbenv/versions/1.9.3-p484/bin/ruby
--with-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-dir}/lib
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-xml2-dir
--with-xml2-include=${xml2-dir}/include
--with-xml2-lib=${xml2-dir}/lib
--with-xslt-dir
--without-xslt-dir
--with-xslt-include=${xslt-dir}/include
--with-xslt-lib
--without-xslt-lib=${xslt-dir}/lib
--with-exslt-dir
--without-exslt-dir
--with-exslt-include
--without-exslt-include=${exslt-dir}/include
--with-exslt-lib
--without-exslt-lib=${exslt-dir}/lib
--with-zlib
--without-zlib
--with-iconvlib
--without-iconvlib
--with-xml2lib
--without-xml2lib
extconf failure: %s
need libxml2.
Install the library or try one of the following options to extconf.rb:
--with-xml2-dir=/path/to/libxml2
--with-xml2-lib=/path/to/libxml2/lib
--with-xml2-include=/path/to/libxml2/include
Although an old question, I though I'd share the solution I found. Before installing the libxslt-ruby gem, run the following:
gem update --system
Here's the documentation for that command:
http://guides.rubygems.org/command-reference/#gem-update
As of April 2022, the following worked for me:
brew install libxslt
gem install libxslt-ruby -v '1.2.0' -- --with-xslt-include="$(brew --prefix libxslt)/include/libxslt" --with-exslt-include="$(brew --prefix libxslt)/include/libexslt"

Error Compiling Postgres pg gem on Ubuntu 12.04 [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Unable to install pg gem on ubuntu - Can’t find the 'libpq-fe.h header
Here is the error while trying to do bundle install
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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=/usr/bin/ruby1.8
--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
--without-pg-config
--with-pg_config
--without-pg_config
Gem files will remain installed in /var/lib/gems/1.8/gems/pg-0.14.1 for inspection.
Results logged to /var/lib/gems/1.8/gems/pg-0.14.1/ext/gem_make.out
i'm using ubuntu 12.04.Can any one point what may be wrong
Looks like you need to install the dev libraries for postgres:
sudo apt-get install libpq-dev

Unable to install gem "pg" on Ubuntu 12.10 (AMD64)

I've been (unsuccessfully) trying to install the "pg" gem on my ruby 1.9.3-p286 but nothing seems to work.
I've already installed postgresql (9.1), libpq-dev and a few others like postgresql-server-dev-9.1. I've tried to pass the "with-pg-config" flag to the gem install but simply nothing seems to work.
Every time I try to install the gem it outputs something like this:
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/home/lynux/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/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
--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=/home/lynux/.rvm/rubies/ruby-1.9.3-p286/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
--without-pg-config
--with-pg_config
--without-pg_config
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
Gem files will remain installed in /home/lynux/.rvm/gems/ruby-1.9.3-p286#phisiodata/gems/pg-0.14.1 for inspection.
Results logged to /home/lynux/.rvm/gems/ruby-1.9.3-p286#phisiodata/gems/pg-0.14.1/ext/gem_make.out
What am I doing wrong? Is there something else that I should do before trying to install the gem?
Thank you in advance.
[EDIT]
Ok, so joelparkerhenderson's answer set me to think that there might me something wrong with paths and libraries and a went on digging a little bit further..
I've found this awesome post and it solved! Basically the problem lies with RVM. So, my problem is solved and for anyone out there that might suffer from the same thing, follow the link!
Your error looks like you're missing libpq-dev
Are you about to install Postgres first on the system?
Try this:
sudo apt-get install postgresql postgresql-client postgresql-server-dev-all libpq-dev
Next, are you able to install the pg gem as root?
sudo su - root
gem install pg

pg gem can't find native extensions -- PostgreSQL installed using Homebrew

I'm on Mac OS X 10.8.2, which I reinstalled a few hours ago in frustration with the issues that follow.
I have installed Homebrew, and when I run brew doctor, it says Your system is raring to brew.
I have the latest Xcode with the command-line utilities.
I have installed PostgreSQL using Homebrew.
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
I have a Rail app with gem 'pg' in its Gemfile, but I can't install the gem:
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.
It seems to be looking for pg_config and libpq, which are easy enough to find:
steven$ ls /usr/local/Cellar/postgresql/9.2.1/bin
... pg_config ...
steven$ ls /usr/local/Cellar/postgresql/9.2.1/include
... libpq ...
So I've tried passing every configuration option I can think of, but none work:
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
What should I do?
FYI, I eventually solved this by uninstalling everything from PostgreSQL and the pg gem right down to Bundler, Homebrew and even RVM before installing every piece again one at a time. Probably I removed more than I had to but everything worked once I put it all back together again.
I don't know if this will help anyone else or not but I had the exact same problem here with PG gem not compiling. My apps live on Heroku, and locally I use RVM, Homebrew, but for Postgres I am using Postgresapp.com
I also use JewerlyBox to give me a nice GUI wrapper around RVM. I compared my Ruby 1.9.3-p194 to 1.9.3-p286 and noticed that I had set 286 to universal. I was hesitant to uninstall everything so I just uninstalled Ruby and reinstalled with the option set to 64-bit only (platform: "x86_64-darwin12.2.0").
After reinstalling Ruby with this option, the PG gem installed without a hitch and I am back to being happy. Hope this helps someone.

Resources