当我尝试安装pg gem时导致此错误的原因是什么?

时间:2011-03-03 11:42:38

标签: ruby-on-rails postgresql gem

我正在尝试安装pg gem

bens-macbook-pro:liferecord ben$ bundle config build.pg --with-pg-config=/users/ben/postgresql/bin
bens-macbook-pro:liferecord ben$ bundle install

我收到此错误:

Installing pg (0.10.1) with native extensions /Users/ben/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

/Users/ben/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb --with-pg-config=/users/ben/postgresql/bin
Using config values from /users/ben/postgresql/bin
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/ben/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
    --with-pg
    --without-pg
    --with-pg-dir
    --without-pg-dir
    --with-pg-include
    --without-pg-include=${pg-dir}/include
    --with-pg-lib
    --without-pg-lib=${pg-dir}/lib
    --with-pg-config
extconf.rb:13:in ``': Permission denied - /users/ben/postgresql/bin --includedir (Errno::EACCES)
    from extconf.rb:13:in `<main>'

导致此错误的原因是什么?

额外信息:

我从one click installer安装了PostgreSQL。

这是我指向pg-config的目录的输出:

bens-macbook-pro:bin ben$ ls
clusterdb       droplang        pg_archivecleanup   pg_dumpall      pgbench         postmaster
createdb        dropuser        pg_config       pg_resetxlog        pltcl_delmod        psql
createlang      ecpg            pg_controldata      pg_restore      pltcl_listmod       reindexdb
createuser      initdb          pg_ctl          pg_standby      pltcl_loadmod       vacuumdb
dropdb          oid2name        pg_dump         pg_upgrade      postgres        vacuumlo

我正在跑步:

Rails 3.0.1
Ruby 1.9.2
OSX 10.6.6

1 个答案:

答案 0 :(得分:4)

如果其他人遇到此问题,则错误是由此引起的:

bundle config build.pg --with-pg-config=/users/ben/postgresql/bin

应该是

bundle config build.pg --with-pg-config=/users/ben/postgresql/bin/pg_config