无法安装gem pg -v'0.15.1'

时间:2014-02-12 03:44:50

标签: ruby-on-rails gem

我已经尝试安装libpq-dev包,并安装postgresql,但是由于gem pg,bundle install仍然失败。这是我得到的错误:

$ gem install pg -v '0.15.1'
Building native extensions.  This could take a while...
/.rvm/rubies/ruby-1.9.3-
p484/lib/ruby/site_ruby/1.9.1/rubygems/ext/builder.rb:73: warning: Insecure 
world writable dir /usr/local in PATH, mode 040777
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

/.rvm/rubies/ruby-1.9.3-p484/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again 
with --with-pg-config=/path/to/pg_config

checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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.

什么是清理混乱的正确方法?

2 个答案:

答案 0 :(得分:0)

如果您使用的是Mac,请安装Homebrew,然后使用

命令安装Postgres

brew install postgresql

或者您可以从here下载并安装Postgres,具体取决于您使用的操作系统。

答案 1 :(得分:0)

没有任何“混乱” - 这是一个标准问题,您的系统没有安装宝石所需的库


<强>库

如评论中所述,您首先需要install PGSQL,这将创建所需的库文件以帮助安装gem,之后您可以使用一些路径引用来帮助安装gem:

gem install pg -- --with-pg-dir="C:/Program Files/installer