gem在mac上安装pg -v 0.12.2错误 [英] gem install pg -v 0.12.2 error on mac

查看:175
本文介绍了gem在mac上安装pg -v 0.12.2错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是编程世界的新手,我有一段时间用ruby on rails解决了捆绑错误。我正在运行OSX 10.9.1,用于Ruby管理的RVM,以及我正在使用的ruby 2.1.1。



我收到的错误是:



Gem :: Ext :: BuildError:错误:无法构建gem原生扩展。
/Users/Removed/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
检查pg_config ... no
没有pg_config ...无论如何。如果构建失败,请再次尝试使用
--with-pg-config = / path / to / pg_config

检查libpq-fe.h .. 。

找不到'libpq-fe.h头文件



* extconf。 rb失败*



由于某些原因无法创建Makefile,可能缺少必要的
库和/或头文件。检查mkmf.log文件以获取更多详细信息。您可能
需要配置选项。
extconf失败,退出代码1



Gem文件将保持安装在/Users/Removed/.rvm/gems/ruby-2.1.1/gems/pg -0.12.2进行检查。
记录到/Users/Removed/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-13/2.1.0/pg-0.12.2/gem_make.out
的结果一个错误安装pg(0.12.2)时发生,并且Bundler无法继续。


经过一番研究,我下载了Postgres应用程序并将其放入应用程序目录。看来我仍然有一个标题问题,所以我试着指定应用程序的include目录。仍然没有决议。我也遇到过一些关于自制的材料,但是我在这里设置的时候感到茫然。如果我可以得到解决一些帮助,将不胜感激。

编辑:



rvm info:

>

ruby​​-2.1.1:

system:
uname:Darwin christohersmini 13.0.0 Darwin Kernel Version 13.0.0:Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72〜6 / RELEASE_X86_64 x86_64
system:osx / 10.9 / x86_64
bash:/ bin / bash => GNU bash,版本3.2.51(1)-release(x86_64-apple-darwin13)
zsh:/ bin / zsh => zsh 5.0.2(x86_64-apple-darwin13.0)



rvm:
版本:rvm 1.25.19(稳定版),Wayne E. Seguin,Michal Papis [https://rvm.io/]
updated:35分钟14秒前
path:/Users/christopherwhittemore/.rvm

ruby​​:
口译员:ruby
版本:2.1.1p76
日期:2014-02-24
平台:x86_64-darwin13.0
patchlevel:2014 -02-24修订版45161
full_version:ruby 2.1.1p7 6(2014-02-24 revision 45161)[x86_64-darwin13.0]



检查我是否在子目录中是个好主意,但很遗憾我不是。我只是试图从应用程序的根目录引导服务器。

解决方案

p>

   -  with-pg-config = / path / to / pg_config 

重新运行安装命令:

  gem install pg --with-pg-config = / Applications / Postgres.app / Contents / MacOS / bin / pg_config 



<这假设你在应用程序文件夹中有Postgres应用程序。你会遇到与Postgres.app的其他问题,但它是值得的通过他们的工作。 OS X中的每个应用程序实际上只是一个您可以查看的文件夹。如果你右键点击应用程序并选择显示内容,你会得到一个新的窗口,让你浏览应用程序文件夹的内容。


I'm new to the world of programming and I'm having a bit of a time resolving a bundling error with ruby on rails. I'm running OSX 10.9.1, RVM for Ruby management, and I am using ruby 2.1.1.

The error I receive is:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /Users/Removed/.rvm/rubies/ruby-2.1.1/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. extconf failed, exit code 1

Gem files will remain installed in /Users/Removed/.rvm/gems/ruby-2.1.1/gems/pg-0.12.2 for inspection. Results logged to /Users/Removed/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-13/2.1.0/pg-0.12.2/gem_make.out An error occurred while installing pg (0.12.2), and Bundler cannot continue.

After a little research I downloaded the Postgres App and put it into the Application directory. It appears I am still having a header problem as well, so I tried try specifying the include directory of the app. Still no resolution. Iv'e also came across some material relating to homebrew,but I'm at a loss for getting set up here. If I could have some help getting sorted out it would be greatly appreciated. Thank you in advance.

Edit:

rvm info :

ruby-2.1.1:

system: uname: "Darwin christohersmini 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64" system: "osx/10.9/x86_64" bash: "/bin/bash => GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13)" zsh: "/bin/zsh => zsh 5.0.2 (x86_64-apple-darwin13.0)"

rvm: version: "rvm 1.25.19 (stable) by Wayne E. Seguin , Michal Papis [https://rvm.io/]" updated: "35 minutes 14 seconds ago" path: "/Users/christopherwhittemore/.rvm"

ruby: interpreter: "ruby" version: "2.1.1p76" date: "2014-02-24" platform: "x86_64-darwin13.0" patchlevel: "2014-02-24 revision 45161" full_version: "ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]"

Checking to see if I'm in a subdirectory was a good idea, but sadly I'm not. I'm just trying to boot the server from the root directory of the application.

解决方案

Try doing what it says:

--with-pg-config=/path/to/pg_config

so re-run the install command like:

gem install pg --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config

This is assuming you have the Postgres app in your Applications folder. You will run into other issues with Postgres.app, but it's worth it to work through them. Every "App" in OS X is really just a folder that you can look into. If you right click on the app and choose "show contents" you will get a new window that will let you browse the content of the app folder.

这篇关于gem在mac上安装pg -v 0.12.2错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆