Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Post OS X 10.10 Yosemite安装Rails错误_Ruby On Rails_Ruby_Rvm - Fatal编程技术网

Ruby on rails Post OS X 10.10 Yosemite安装Rails错误

Ruby on rails Post OS X 10.10 Yosemite安装Rails错误,ruby-on-rails,ruby,rvm,Ruby On Rails,Ruby,Rvm,我安装了Mac OS Yosemite,但现在Rails无法正常工作 当我尝试执行rails s时,它会告诉我执行捆绑安装 我在尝试运行捆绑安装后收到此消息: Errno::EACCES: Permission denied - /Users/giowong/rails_project/doctible_pre_treatment/vendor/bundle/ruby/2.0.0/gems/bcrypt-3.1.7/.gitignore 是的 及 当我这样做的时候,我得到了这些讨厌的东西: G

我安装了Mac OS Yosemite,但现在Rails无法正常工作

当我尝试执行
rails s
时,它会告诉我执行
捆绑安装

我在尝试运行
捆绑安装
后收到此消息:

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

当我这样做的时候,我得到了这些讨厌的东西:

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.

但是没有运气

我不建议使用OSX提供的默认Ruby,因此请安装RVM。您还需要安装Xcode命令行工具:

xcode-select --install # click install, not Get Xcode
然后验证是否安装了gcc:

gcc --version
然后才运行:

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

是RVM的一个有价值的替代方案;当你使用
sudo
安装gem时,你是在修改苹果安装的Ruby,所以不要这样做,让系统使用它。相反,使用Ruby版本管理器,如或。而且,无论使用哪种方法,在为他们管理的Ruby安装任何东西时,都不要使用
sudo
,否则会造成严重的混乱。如果您使用RVM,请阅读整个安装说明,以便了解您应该做什么。
xcode-select --install # click install, not Get Xcode
gcc --version
\curl -sSL https://get.rvm.io | bash -s stable --rails