无法安装postgresql gem

时间:2014-01-30 10:10:17

标签: ruby-on-rails gem

  

$ sudo gem install pg Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
     

extconf.rb检查pg_config ...否否pg_config ...尝试无论如何。   如果建筑失败,请再试一次   --with -pg-config = / path / to / pg_config检查libpq-fe.h ...否找不到'libpq-fe.h头    * extconf.rb失败* 由于某些原因无法创建Makefile,可能缺少必要的库和/或标头。校验   mkmf.log文件以获取更多详细信息。您可能需要配置   选项。

     

提供配置选项:

    --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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
  --with-pg
  --without-pg
  --with-pg-config
  --without-pg-config
  --with-pg_config
  --without-pg_config
  --with-pg-dir
  --without-pg-dir
  --with-pg-include
  --without-pg-include=${pg-dir}/include
  --with-pg-lib
  --without-pg-lib=${pg-dir}
     

/ Gem文件将保持安装状态   /Library/Ruby/Gems/2.0.0/gems/pg-0.17.1进行检查。记录结果   to /Library/Ruby/Gems/2.0.0/gems/pg-0.17.1/ext/gem_make.out

1 个答案:

答案 0 :(得分:1)

在错误消息中,它明确指出ERROR: Failed to build gem native extension.这很可能意味着您没有安装“本机”扩展,这是PostgreSQL实际软件。

这是因为运行gem需要本机扩展,因为gem只是实际数据库软件的ruby包装器。有关如何安装Postgres的详细说明,请参见here

相关问题