Offer instructions for pg gem when installed via Homebrew #7898

Merged
merged 1 commit into from Oct 10, 2012

Conversation

Projects
None yet
6 participants
Contributor

olivierlacan commented Oct 10, 2012

Noticed that when running rails new appname -d postgresql the generated database.yml still starts with the following:

# PostgreSQL. Versions 8.2 and up are supported.
#
# Install the pg driver:
#   gem install pg
# On Mac OS X with macports:
#   gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
#   gem install pg
#       Choose the win32 build.
#       Install PostgreSQL and put its /bin directory on your path.

Added instruction for the widely used Homebrew and clarified:

# On OS X with Homebrew:
#   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

@vijaydev vijaydev commented on an outdated diff Oct 10, 2012

...s/rails/app/templates/config/databases/postgresql.yml
@@ -2,7 +2,9 @@
#
# Install the pg driver:
# gem install pg
-# On Mac OS X with macports:
+# On OS X with PostgreSQL installed via Homebrew:
@vijaydev

vijaydev Oct 10, 2012

Member

we don't need "with PostgreSQL" here.

Contributor

olivierlacan commented Oct 10, 2012

@vijaydev fixed it.

@vijaydev vijaydev added a commit that referenced this pull request Oct 10, 2012

@vijaydev vijaydev Merge pull request #7898 from olivierlacan/pg_homebrew_instructions
Offer instructions for pg gem when installed via Homebrew
2441160

@vijaydev vijaydev merged commit 2441160 into rails:master Oct 10, 2012

@spastorino spastorino commented on the diff Oct 10, 2012

...s/rails/app/templates/config/databases/postgresql.yml
@@ -2,7 +2,9 @@
#
# Install the pg driver:
# gem install pg
-# On Mac OS X with macports:
+# On OS X with Homebrew:
+# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
@spastorino

spastorino Oct 10, 2012

Owner

Isn't with Homebrew ok to just do gem install pg ?

@olivierlacan

olivierlacan Oct 11, 2012

Contributor

Not sure if it is. For a while after Lion was released trying to run gem install pg would cause the following error:
missing required architecture x86_64 in file for architecture x86_64

And that was resolved by pointing the pg gem to the actual configuration from the Homebrew install.

I've since added that --with-pg-config flag to my system-wide bundler settings as a precaution.

I'll blast my Homebrew install on my home machine tonight and remove that bundler setting to see if it blows up on Mountain Lion as it did, but unless the pg gem was fixed to account for that, that certainly risks being an issue for Lion users.

@michelegera

michelegera Oct 11, 2012

I'm on Mountain Lion 10.8.2 and using Homebrew, and a gem install pg with no additional flag sufficed. Gem version is 0.14.1.

@rafaelfranca

rafaelfranca Oct 15, 2012

Owner

Me too. This is a troubleshoot comment, but the normal flow is to use gem install pg.

I'm not sure if we should add troubleshoot comments in the generated files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment