0

Result of 'bundle install' in Terminal:

An error occurred while installing pg (0.16.0), and Bundler cannot continue.
Make sure that `gem install pg -v '0.16.0'` succeeds before bundling.

Result of 'which psql' in Terminal:

/usr/bin/psql

/etc/paths looks like this:

/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/Applications/Postgres93.app/Contents/MacOS/bin

Result of gem install pg

/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem:4: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

        /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb

Result of brew install postgres:

Warning: A newer Command Line Tools release is available
The standalone package can be obtained from
https://developer.apple.com/downloads/,
or it can be installed via Xcode's preferences.
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/postgresql-
######################################################################## 100.0%
==> Pouring postgresql-9.3.2.mountain_lion.bottle.tar.gz
==> Caveats
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
  https://github.com/Homebrew/homebrew/issues/issue/2510

To migrate existing data from a previous major version (pre-9.3) of PostgreSQL, see:
  http://www.postgresql.org/docs/9.3/static/upgrading.html

When installing the postgres gem, including ARCHFLAGS is recommended:
  ARCHFLAGS="-arch x86_64" gem install pg

To install gems without sudo, see the Homebrew wiki.

To have launchd start postgresql at login:
    ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
Then to load postgresql now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Or, if you don't want/need launchctl, you can just run:
    postgres -D /usr/local/var/postgres
Warning: Could not link postgresql. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link postgresql'

Possible conflicting files are:
Warning: Could not link postgresql. Unlinking...
Error: Permission denied - /usr/local/lib/pkgconfig

Not sure what else I can try - I have the Postgres app installed as well.

Craig Ringer
  • 307,061
  • 76
  • 688
  • 778
  • Regarding `brew install postgres`: Looks like permissions on `/usr/local` are not right. What do `brew doctor`, `ls -ld /usr/local` and `ls -ld /usr/local/lib` report? – Jimothy Jan 08 '14 at 22:24
  • possible duplicate of [Impossible to Install PG gem on my mac with Mavericks](http://stackoverflow.com/questions/19625487/impossible-to-install-pg-gem-on-my-mac-with-mavericks) – Jimothy Jan 08 '14 at 22:30
  • **Always** explain how you installed PostgreSQL on your system. Is homebrew the only PostgreSQL install here, or is it an attempt you made to solve a problem by installing a second copy of PostgreSQL? – Craig Ringer Jan 09 '14 at 00:38

1 Answers1

2

If you're using Postgress.app, you need to specify --with-pg-config when you install the Gem.

See this Q&A for details.

Community
  • 1
  • 1
Jimothy
  • 9,150
  • 5
  • 30
  • 33
  • Yep. And installing another build of PostgreSQL instead is *not* the answer. The "flail around running random commands until it seems to work" school seems to be popular with a subset of the Rails crowd (lots of newbie programmers presumably) and creates pain like this question. Thanks for a clear "the right way" kind of answer. – Craig Ringer Jan 09 '14 at 00:39