Slick23
Slick23

Reputation: 5897

Having trouble installing the PG gem

I'm trying this, as the docs say:

gem install pg --with-pg-config=/opt/local/lib/postgresql90/bin/pg_config
ERROR:  While executing gem ... (OptionParser::InvalidOption)

But, that's obviously not working. Can anyone spot an error?

Upvotes: 0

Views: 284

Answers (2)

Slick23
Slick23

Reputation: 5897

Not sure if the other answer works, but I thought I'd point out that the instructions here did work if you're using bundler to manage gems:

http://devblog.vworkapp.com/post/403869225/install-pg-gem-via-bundler-on-osx-snow-leopard

install postgres from Mac Ports

sudo port install postgres84

Include the postgres binaries in the PATH environment variable

export PATH=/opt/local/lib/postgresql84/bin:${PATH}

Then run bundle install with the all-important arch flag

env ARCHFLAGS="-arch x86_64" bundle install

Caveats: Your ARCHFLAGS may be something like i386 and not x86_64, depending on your local environment (and these instructions are obviously installing an older postgres -- I did sudo port install postgresql90).

Upvotes: 1

mu is too short
mu is too short

Reputation: 434575

The example that you're linking to says this:

gem install -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
#-----------^^

Note the -- in there that you're not using. I suspect that gem is trying to parse the --with-pg-config as an option to gem rather than an option to the gem itself. Just a plain -- in an option list means "stop parsing options here" so try one of these:

gem install -- pg --with-pg-config=/opt/local/lib/postgresql90/bin/pg_config
gem install pg -- --with-pg-config=/opt/local/lib/postgresql90/bin/pg_config

One of those should keep gem from trying to interpret --with-pg-config as a gem option and get it down to the pg gem itself.

Upvotes: 1

Related Questions