I’m about to host a web app on Heroku and they are using PostgreSQL for database. Followed the instructions and added gem ‘pg’ to my Gemfile and made bundle install but it failed:
Installing pg (0.11.0) with native extensions /Users/kalle/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

Thought I didn’t have PostgreSQL installed so installed it via MacPorts:
sudo port install postgresql90

but still got the same error! After a bit of googling I found out it was due to that the bin folder was not in the path. So by doing this it worked:
export PATH=/opt/local/lib/postgresql90/bin/:${PATH}
env ARCHFLAGS="-arch x86_64" bundle install