试图在OS X 10.8.5上构建Pg gem

时间:2014-01-08 21:38:09

标签: ruby-on-rails ruby macos postgresql psql

终端中“捆绑安装”的结果:

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.

终端中“哪个psql”的结果:

/usr/bin/psql

/ etc / paths看起来像这样:

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

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

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

不确定我还能尝试什么 - 我也安装了Postgres应用程序。

1 个答案:

答案 0 :(得分:2)

如果您使用的是Postgres.app,则需要在安装Gem时指定--with-pg-config

有关详细信息,请参阅this Q&A