如何让Ruby在Yosemite上工作

时间:2014-11-06 13:07:33

标签: ruby rubygems osx-yosemite

自升级到优胜美地后,我无法使用我的Ruby应用程序。我认为这与应用程序本身(livereload)有关但我在其他Web开发应用程序上遇到了同样的错误。我用google搜索无效,并且不熟练使用Ruby调试自己...

如果有人可以放弃任何光线,这是输出?

/Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:212:in `initialize': Permission denied - /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14/2.0.0/nokogiri-1.6.1/gem_make.out (Errno::EACCES)
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:212:in `open'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:212:in `write_gem_make_out'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:132:in `build_error'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:171:in `rescue in build_extension'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:156:in `build_extension'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:195:in `each'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:195:in `build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1436:in `block in build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/user_interaction.rb:45:in `use_ui'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1434:in `build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/stub_specification.rb:60:in `build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in `each'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in `find'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in `find_inactive_by_path'
from /Library/Ruby/Site/2.0.0/rubygems.rb:185:in `try_activate'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from /Applications/LiveReload.app/Contents/Resources/SASS.lrplugin/lib/compass/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb:2:in `<top (required)>'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Applications/LiveReload.app/Contents/Resources/SASS.lrplugin/lib/compass/lib/compass/sass_extensions/sprites/engines.rb:25:in `<top (required)>'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Applications/LiveReload.app/Contents/Resources/SASS.lrplugin/lib/compass/lib/compass/sass_extensions/sprites.rb:18:in `<top (required)>'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Applications/LiveReload.app/Contents/Resources/SASS.lrplugin/lib/compass/lib/compass/sass_extensions.rb:10:in `<top (required)>'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Applications/LiveReload.app/Contents/Resources/SASS.lrplugin/lib/compass/lib/compass.rb:5:in `block in <top (required)>'
from /Applications/LiveReload.app/Contents/Resources/SASS.lrplugin/lib/compass/lib/compass.rb:4:in `each'
from /Applications/LiveReload.app/Contents/Resources/SASS.lrplugin/lib/compass/lib/compass.rb:4:in `<top (required)>'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Applications/LiveReload.app/Contents/Resources/SASS.lrplugin/lib/compass/bin/compass:20:in `block in <main>'
from /Applications/LiveReload.app/Contents/Resources/SASS.lrplugin/lib/compass/bin/compass:8:in `fallback_load_path'
from /Applications/LiveReload.app/Contents/Resources/SASS.lrplugin/lib/compass/bin/compass:19:in `<main>'

2 个答案:

答案 0 :(得分:0)

我使用ruby-install获得长期红宝石幸福:)

以下是我在osx中​​设置ruby环境的方法。

brew update
brew install ruby-install
brew install chruby
ruby-install ruby

最后一行需要一些时间,并为您安装一个新的红宝石2.1.3。

现在,将以下内容添加到〜/ .bashrc或〜/ .zshrc文件的末尾:

source /usr/local/opt/chruby/share/chruby/chruby.sh

就是这样!

这将在/Users/bibstha/.rubies/ruby-2.1.3/中安装ruby。由于这是您的主文件夹,因此在安装宝石时不会出现任何权限问题,并且不会弄乱您的系统。

答案 1 :(得分:0)

使用RVMhttp://rvm.io/):

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

另见How to get Ruby / Homebrew / RVM to work on Yosemite?