I have been having a lot of troubles with Rails after upgrading to Mountain Lion.
Trying to trouble shoot these and searching for hours on the internet so far I have
Alternatively, use the Postgres app. IMO, it's the easiest and fastest way to get up and running with PostgreSQL and Rails on Mac.
For detailed instructions: http://blog.parsalabs.com/blog/2013/09/14/installing-postgresql-don-mac-os-x-and-using-it-as-your-rails-apps-database/
Download the postgresSQL installer from http://www.enterprisedb.com/products-services-training/pgdownload#osx
and then make your path look something like this:
PATH=$PATH:/Library/PostgreSQL/9.0/bin/ gem install pg
This would do!
Note: Please specify your postgreSQL installed version correctly in the path.
On OS X with Homebrew:
Install postgresql using:
brew install postgresql
Then install the gem using:
gem install pg -- --with-pg-config=/usr/local/bin/pg_config
On OS X with MacPorts:
gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
Hope this helps!
As banditKing says in his answer, need to tell the gem where to find the postgres binaries. You can use the binaries included with the excellent and easy postgres.app from Heroku ( http://postgresapp.com ) to install this gem instead of the EnterpriseDb version. The EnterpriseDB version is great, but an involved install for a dev machine.
Download Postgres.app on your system and add the internal bin directory to your path. I put it in /Applications/Postgres.app
, so I used
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
worked for me on 10.8.2, Ruby 1.9.3, pg-0.14.1, and the XCode CLI tools
After installing Mavericks bundle update
was throwing an error on the pg gem.
I use Brew to manage my packages and postgresql was already installed, but still I was getting the 'no pg_config' error.
The fix was to just brew uninstall postgresql
, then brew install postgresql
. After which I was immediately able to successfully run bundle update
.