简体   繁体   English

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

[英]What is causing this error when I try to install the pg gem?

I'm trying to install the pg 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

I get this error: 我收到此错误:

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>'

What is causing this error? 导致此错误的原因是什么?

Extra info: 额外信息:

I installed PostgreSQL from the one click installer . 我从一键安装程序安装了PostgreSQL。

Here is the output of the directory that I point to for pg-config: 这是我指向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

I'm running: 我在跑:

Rails 3.0.1
Ruby 1.9.2
OSX 10.6.6

In case anyone else has this problem, the error was caused by this: 如果其他人有这个问题,错误是由此引起的:

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

It should be 它应该是

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM