2

I'm trying to install the Devises gem, running bundle install and then getting this error with bcrypt-ruby which I haven't had before. What can I do?

Installing bcrypt-ruby (3.0.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb 
creating Makefile

make
xcrun cc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common   -c bcrypt_ext.c
Error: No developer directory found at /Developer. Run /usr/bin/xcode-select to update the developer directory path.
make: *** [bcrypt_ext.o] Error 1


Gem files will remain installed in /Users/Fryed/.bundler/tmp/25124/gems/bcrypt-ruby-3.0.1 for inspection.
Results logged to /Users/Fryed/.bundler/tmp/25124/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out
An error occured while installing bcrypt-ruby (3.0.1), and Bundler cannot continue.
Make sure that `gem install bcrypt-ruby -v '3.0.1'` succeeds before bundling.

Okay, so I need to install bcrypt-ruby...

wpub-6-65:treebook Fryed$ sudo gem install bcrypt-ruby -v '3.0.1'
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing bcrypt-ruby:
    ERROR: Failed to build gem native extension.

        /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
creating Makefile

make
xcrun cc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common   -c bcrypt_ext.c
Error: No developer directory found at /Developer. Run /usr/bin/xcode-select to update the developer directory path.
make: *** [bcrypt_ext.o] Error 1


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/bcrypt-ruby-3.0.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out
4

2 回答 2

0

要么你没有安装 XCode,要么你的开发者目录配置不正确。

如果是第一个,请尝试安装 XCode。

如果是第二个,试试这个(或一些变化,取决于你的 XCode 目录在哪里)

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
于 2013-03-30T14:03:21.720 回答
0
gem 'bcrypt-ruby', '~>3.0.1', :github => 'rking/bcrypt-ruby'

rking 的 bcrypt-ruby 分支注释掉 3.0.1 的失败 c 编译补丁。Bcrypt-ruby 在一年前修复了这个问题,但不是针对版本 3.0.1,这似乎是您的 Rails 应用程序所需的依赖项。

在 github 上查看问题: https ://github.com/bundler/bundler/issues/2410

于 2014-02-20T23:03:39.707 回答