简体   繁体   English

发布OS X 10.10 Yosemite安装Rails错误

[英]Post OS X 10.10 Yosemite install Rails error

I did a clean install of Mac OS Yosemite, but now Rails won't work properly. 我干净安装了Mac OS Yosemite,但现在Rails无法正常工作。

When I try to do rails s it tells me to do bundle install . 当我尝试做rails s它告诉我要进行bundle install

I get this message after trying to run bundle install : 尝试运行bundle install后,我收到此消息:

Errno::EACCES: Permission denied - /Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.0.0/gems/bcrypt-3.1.7/.gitignore

I did 我做到了

sudo gem update --system

and

bundle install

When I do this, I'm getting this nasty stuff: 当我这样做时,我得到了这些令人讨厌的东西:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20141107-39214-1ds3j4x.rb extconf.rb 
checking for ruby/util.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
 need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir  
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
  /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:434:in      `try_do': The compiler failed to generate an executable file. (RuntimeError)
  You have to install development tools first.
from          /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `block in try_compile'
from        /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:502:in `with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1044:in `block in have_header'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1043:in `have_header'
from extconf.rb:14:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in      /Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.0.0/gems/bcrypt-3.1.7 for inspection.

 Results logged to     /Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.0.0/extensions/universal-darwin-14/2.0.0/bcrypt-3.1.7/gem_make.out
 An error occurred while installing bcrypt (3.1.7), and Bundler cannot continue.
 Make sure that `gem install bcrypt -v '3.1.7'` succeeds before bundling.

I've tried installing using 我试过安装使用

 \curl -sSL https://get.rvm.io | bash -s stable --rails

but no luck. 但没有运气。

I don't recommend using the default Ruby provided with OS X, so install RVM instead. 我不建议使用随OS X提供的默认Ruby,因此请安装RVM。 You will also need to install the Xcode command line tools: 您还需要安装Xcode命令行工具:

xcode-select --install # click install, not Get Xcode

Then verify if gcc is installed: 然后验证是否安装了gcc:

gcc --version

And only then run: 然后才运行:

\curl -sSL https://get.rvm.io | bash -s stable --rails

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM