本文介绍了为什么我会收到 bcrypt-ruby gem 安装错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试安装 gem 设计时出错,安装正在停止宝石 bcrypt-ruby:

Getting an error when trying to install the gem devise, the installation is stopping onthe gem bcrypt-ruby:

$ gem install bcrypt-ruby
Error installing bcrypt-ruby:
ERROR: Failed to build gem native extension.

我在 RVM 下使用 Ruby 运行 OSX 10.6.7.我重新安装了最新版本的 xcode &重新安装了 Ruby 64 位、Rails 和所有 gems.

I'm running OSX 10.6.7 with Ruby under RVM.I reinstalled the lastest version of xcode & reinstalled Ruby 64bit, Rails and all the gems.

推荐答案

我在 OSX 10.7.3 下安装时遇到了同样的问题.安装 gem 时,我的错误消息是:

I had the same problem installing under OSX 10.7.3. When installing the gem, my error message was:

Building native extensions.  This could take a while...
ERROR:  Error installing bcrypt-ruby:
ERROR: Failed to build gem native extension.

creating Makefile

make
compiling bcrypt_ext.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [bcrypt_ext.o] Error 1

看起来 gem 正在寻找 gcc-4.2 但我只有一个名为 gcc 的文件.现在因为我刚刚安装了最新的 Xcode (4.3),我知道我的 C 编译器是兼容的,但是 gem 硬编码了 gcc-4.2.所以我的解决方案是:

Looks like the gem is looking for gcc-4.2 but I only had a file called gcc. Now since I had just installed the latest Xcode (4.3), I knew that my C compiler was compliant but the gem had gcc-4.2 hardcoded into it. So my solution was:

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2

链接就像一个魅力.

这篇关于为什么我会收到 bcrypt-ruby gem 安装错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 13:58