我正在尝试安装Devises gem,运行bundle install
然后使用bcrypt-ruby获取此错误,这是我之前没有的。我该怎么办?
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.
好的,所以我需要安装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
答案 0 :(得分:0)
您尚未安装XCode或您的开发人员目录配置不正确。
如果是第一个,请尝试安装XCode。
如果是第二个,请尝试此(或某些变体,具体取决于您的XCode目录所在的位置)
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
答案 1 :(得分: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