Can't find the PostgreSQL client library (libpq)
$ sudo su
$ env ARCHFLAGS="-arch x86_64" gem install pg
Building native extensions. This could take a while...
Successfully installed pg-0.11.0
1 gem installed
Installing ri documentation for pg-0.11.0...
Installing RDoc documentation for pg-0.11.0...
WORKED!
I tried the top-rated answer here:
env ARCHFLAGS="-arch x86_64" gem install pg
But when I tried running bundle install again, it had the same error. Then I tried the entire bundle install with ARCHFLAGS like so:
ARCHFLAGS="-arch x86_64" bundle install
Worked for me! Make sure to replace x86_64 with i386 depending on what architecture you have.
I was just having this problem when using the EnterpiseDB .dmg. If that's the same think you used, I got it to work by specifying the right architecture:
sudo env ARCHFLAGS="-arch i386" gem install pg
There are some tutorials on the web that said to specify a different architecture (like "-arch x86_64" for people who used MacPorts) but it wasn't working for me because I used the single file install.