在OS X上安装PG gem - 无法构建原生扩展 [英] Installing PG gem on OS X - failure to build native extension

查看:83
本文介绍了在OS X上安装PG gem - 无法构建原生扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看起来很多人在安装pg gem时遇到了问题。没有任何其他解决方案为我工作。



我试图安装pg gem和postgres.app。 PG宝石不会安装。我得到的第一个错误是:

安装pg(0.17.0)时发生错误,Bundler无法继续。
在捆绑之前确保 gem install pg -v'0.17.0'成功。



有关将我的gem install指向pg配置的安装建议失败,并显示以下错误消息(本论坛中许多其他人遇到此问题):

 未能构建本机扩展...结果记录到/Users/melanie/.rvm/gems/ruby-1.9.3-p448/gems/pg-0.17.0/ext/gem_make.out 

我不知道如何查找或访问此日志文件以搜索更多线索。

当我尝试使用sudo apt-get install命令时,我也收到一条错误消息(找不到命令)。我在过去的6个小时里搜索了这个论坛,尝试了每一条建议,让pg与我的rails项目合作。



我无法找到关于如何改变路径,或者具体地说,需要做什么改变。我的其中pg_config 返回一个文件源。我已经使用该命令来使用该配置安装pg。它失败了。



有这么多人遇到麻烦。许多答案建议自制。我不得不删除它,因为它抛出了其他问题。

解决方案

直到我下载了OS X 10.9(小牛队)。叹息,另一个操作系统升级头痛。



以下是我如何修复它(使用自制软件):


  • 安装Xcode Tools的另一个版本(在终端中键入 brew update 会提示您更新Xcode构建工具)

  • brew update

  • brew install postgresql



之后 gem install pg 为我工作。


It seems many others have had problems installing the pg gem. None of the solutions posed for others have worked for me.

I have tried to install the pg gem and postgres.app. The pg gem won't install. The first error I get is:

An error occurred while installing pg (0.17.0), and Bundler cannot continue. Make sure that gem install pg -v '0.17.0' succeeds before bundling.

The installation advice about pointing my gem install to the config for pg fails with the following error message (which many others on this forum have encountered):

Failed to build native extensions... Results logged to /Users/melanie/.rvm/gems/ruby-1.9.3-p448/gems/pg-0.17.0/ext/gem_make.out

I don't know how to find or access this log file to search for further clues.

I also get an error message (command not found) when I try using the sudo apt-get install command. I've scoured this forum for the last 6 hours, trying each piece of advice to get pg working with my rails project.

I can't find advice about how to change a path, or specifically, what change is required. My which pg_config returns a file source. I've used that with a command to install pg using that config. It fails.

There are so many people that have had trouble with this. Many answers suggest homebrew. I've had to remove that because it threw up other issues.

解决方案

Same error for me and I didn't experience it until I downloaded OS X 10.9 (Mavericks). Sigh, another OS upgrade headache.

Here's how I fixed it (with homebrew):

  • Install another build of Xcode Tools (typing brew update in the terminal will prompt you to update the Xcode build tools)
  • brew update
  • brew install postgresql

After that gem install pg worked for me.

这篇关于在OS X上安装PG gem - 无法构建原生扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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