简体   繁体   English

PostgreSQL的pg gem将不会安装在OS X上

[英]PostgreSQL's pg gem won't install on OS X

I've looked all the solutions in the internet for this, reinstalled everything and still nothing... When i do gem install pg i get: 我已经在互联网上查找了所有解决方案,重新安装了所有内容,仍然一无所获...当我执行gem install pg时,我得到:

Building native extensions. 构建本机扩展。 This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension. 这可能需要一段时间...错误:安装pg时出错:错误:无法生成gem本机扩展。

  /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb --with-pgsql->lib=/usr/local/Cellar/postgresql/9.2.1/lib --with-pg->config=/usr/local/Cellar/postgresql/9.2.1/bin/pg_config 

Using config values from /usr/local/Cellar/postgresql/9.2.1/bin/pg_config checking for libpq-fe.h... * extconf.rb failed * Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. 使用/usr/local/Cellar/postgresql/9.2.1/bin/pg_config中的配置值检查libpq-fe.h ... * extconf.rb失败*由于某些原因(可能缺少必需的库)而无法创建Makefile和/或标题。 Check the mkmf.log file for more details. 检查mkmf.log文件以获取更多详细信息。 You may need configuration options. 您可能需要配置选项。

Provided configuration options: --with-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=. 提供的配置选项:--with-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/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/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 /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:506:in --curdir --ruby = /用户/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/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 /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381 try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:506:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:506:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:506:in try_cpp' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:970:in block in find_header' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in block in checking_for' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in block (2 levels) in postpone' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in open' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in block in postpone' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in open' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in postpone' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in checking_for' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.r try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:506:in /Users/henriquedubugras/.rvm/rubies/ruby-1.9的/Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:506: .3-p194 / lib / ruby​​ / 1.9.1 / mkmf.rb:970: block in find_header' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:inblock in find_header' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in ' block (2 levels) in postpone' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in打开状态'来自/Users/henriquedubugras/.rvm/rubies /ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284: block in postpone' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby block in postpone' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in open'from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in postpone' from /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in的/Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in .3-p194 / lib / ruby​​ / 1.9.1 / mkmf.r b:969:in find_header' from extconf.rb:41:in ' b:969:in find_header' from extconf.rb:41:in '

Gem files will remain installed in /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/pg-0.14.1 for inspection. 宝石文件将保留安装在/Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/pg-0.14.1中以进行检查。 Results logged to /Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/pg-0.14.1/ext/gem_make.out 结果记录到/Users/henriquedubugras/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/pg-0.14.1/ext/gem_make.out

I tried setting the pg_config path, my xcode is installed, my command line tools from xcode is installed, my ruby version is 1.9.3 installed by RVM. 我尝试设置pg_config路径,安装了xcode,安装了来自xcode的命令行工具,我的ruby版本是RVM安装的1.9.3。

My mac is OS X Mountain Lion 我的Mac是OS X Mountain Lion

Thanks guys! 多谢你们!

You're missing the Postgres client library header files (libpq-fe.h). 您缺少Postgres客户端库头文件(libpq-fe.h)。 In Debian the package is called libpq-dev. 在Debian中,该软件包称为libpq-dev。 I don't know Mac packaging at all, but if there's no Mac respository building the PG client libs from source would work. 我根本不知道Mac的包装,但是如果没有Mac存储库,从源代码构建PG客户端库就可以了。

i would recommend installing rvm https://rvm.io/rvm/install then run rvm requirements. 我建议安装rvm https://rvm.io/rvm/install,然后运行rvm要求。 this will install all required packages, you're probably missing "gcc49" after this install rails and yore good to install postgres. 这将安装所有必需的软件包,在此安装导轨之后,您可能会丢失“ gcc49”,并且过去安装Postgres很好。 i would suggest postgresapp or postgresql. 我建议使用postgresapp或postgresql。

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

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