如何在雪豹上安装gem pg

编程入门 行业动态 更新时间:2024-10-10 04:26:31
本文介绍了如何在雪豹上安装gem pg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要在雪豹上安装gem pg,因为我正在Rails代码库上运行rake.我不使用postgres.

I need to install gem pg on snow leopard because I am running rake on rails codebase. I am not using postgres.

这是我遇到的错误.

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

查看了Google搜索中的各种博客,但没有一个起作用.

looked at various blogs from google search but none of them work.

推荐答案

您可能必须指定您的CPU体系结构.首先,运行以下命令查看您正在运行的体系结构:

You may have to specify your CPU architecture. First, run the following to see which architecture you're running on:

(注意:将"/usr/bin/ruby​​"替换为哪个红宝石"返回).

(Note: Replace '/usr/bin/ruby' with whatever 'which ruby' returns).

$ lipo -detailed_info /usr/bin/ruby

在那里,您应该会看到有关体系结构的内容(查找"i386"或"x86_64")

In there, you should see something about your architecture (look for 'i386' or 'x86_64')

如果这不起作用,请尝试以下操作:

If that doesn't work, try the following:

$ irb ['foo'].pack('p').size

如果Ruby以64位运行,则结果为'8',如果以32位运行,则结果为'4'.

The result will be '8' if Ruby is running as 64-bit, or '4' if it's running in 32-bit.

然后,当您要安装Postgres gem时,请指定适当的体系结构:

Then, when you go to install the Postgres gem, specify the appropriate architecture:

$ sudo env ARCHFLAGS="-arch i386" gem install pg

或者,

$ sudo env ARCHFLAGS="-arch x86_64" gem install pg

如果您使用64位CPU运行Snow Leopard,则可能正在运行64位版本. 但是仍然请务必仔细检查您的体系结构,否则可能无法正常工作. ;)

If you're running Snow Leopard with a 64-bit CPU, then you're probably running the 64-bit version. But still be sure to double-check your architecture, otherwise it probably won't work. ;)

更多推荐

如何在雪豹上安装gem pg

本文发布于:2023-10-14 03:52:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1489944.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:雪豹   如何在   pg   gem

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!