Brew - 无法加载此类文件 - ruby​​gems.rb(LoadError)

时间:2016-07-01 03:43:51

标签: ruby homebrew

我需要帮助进行brew设置。我尝试过重新安装brew和ruby,但我觉得我只是让事情变得更糟。

一些信息:  OS X El Capitan V. 10.11.5

$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15.5.0]

$ which -a ruby
/usr/local/bin/ruby
/usr/bin/ruby

当我尝试更新brew时:

$ brew update
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
    from <internal:gem_prelude>:1:in `<compiled>'
Error: Git must be installed and in your PATH!

当我尝试安装ruby时:

$ rvm install ruby
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.11/x86_64/ruby-2.3.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
    from <internal:gem_prelude>:1:in `<compiled>'

Installing requirements for osx.
Updating system.......
Error running 'requirements_osx_brew_update_system ruby-2.3.0',
showing last 15 lines of /Users/Ben/.rvm/log/1467344813_ruby-2.3.0/update_system.log
    https://github.com/Homebrew/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.'
++ rvm_pretty_print stderr
++ case "${rvm_pretty_print_flag:=auto}" in
++ case "${TERM:-dumb}" in
++ case "$1" in
++ [[ -t 2 ]]
++ return 1
++ printf %b 'Failed to update Homebrew, follow instructions here:
    https://github.com/Homebrew/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.\n'
Failed to update Homebrew, follow instructions here:
    https://github.com/Homebrew/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.
++ return 1
Requirements installation failed with status: 1.

我尝试过:https://stackoverflow.com/a/24789161/4459422

请告诉我解决此问题需要哪些其他信息,并提前感谢您的帮助!

4 个答案:

答案 0 :(得分:1)

尝试重新安装ruby并执行此操作,输入以下命令:

rvm fix-permissions

rvm reinstall 2.3.1

答案 1 :(得分:0)

这条命令搞砸了我:https://stackoverflow.com/a/24789161/4459422

sudo ln -s /System/Library/Frameworks/Ruby.framework/Versions/1.8 
/System/Library/Frameworks/Ruby.framework/Versions/Current

我使用版本2.0已更新为

 sudo ln -s /System/Library/Frameworks/Ruby.framework/Versions/2.0 
    /System/Library/Frameworks/Ruby.framework/Versions/Current

答案 2 :(得分:0)

对于任何为我阅读此答案的人来说,它都与红宝石无关。至少对我来说,答案是在homebrew forum SMillerDev答案上。

首先尝试运行:

brew update-reset

如果不起作用,请运行:

cd $(brew --repo)
git add .
git fetch
git reset --hard origin/master

希望这可以帮助其他人。

答案 3 :(得分:-1)

您实际上可以使用OSX附带的系统Ruby安装brew。不需要从RVM安装Ruby来安装brew。

哪个版本的OSX这是顺便说一句?哪个版本的红宝石是系统红宝石?另请尝试brew doctor