如何在El Capitan重新安装啤酒?

时间:2015-12-22 18:31:04

标签: ruby homebrew osx-elcapitan

我被迫在El Capitan上重新安装brew,ruby。

实际上我不记得究竟是怎么回事,但我丢了啤酒而我没有重新安装它。

这是我尝试重新安装时收到的消息:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
from <internal:gem_prelude>:1:in `<compiled>'

首先,一些信息:

>which ruby
/usr/local/bin/ruby

>ruby --version
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin12.6.0]

并且,如果我尝试修复ruby:

>rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p643]
[ruby-]2.1.4
[ruby-]2.1[.5]
[ruby-]2.2[.1]
[ruby-]2.2-head
ruby-head

>rvm install 2.2
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/osx/10.11/x86_64/ruby-2.2.1.tar.bz2
Checking requirements for osx.
About to install Homebrew, press `Enter` for default installation in `/usr/local`,
type new path if you wish custom Homebrew installation (the path needs to be writable for user)
: 
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
    from <internal:gem_prelude>:1:in `<compiled>'
Requirements installation failed with status: 1.

现在怎么办?

2 个答案:

答案 0 :(得分:2)

我发现了问题。

我跑了type -a ruby并看到我安装了两个ruby:一个在/ usr / bin上,另一个在/ usr / local / bin

我只是mv /usr/local/bin/ruby /usr/local/bin/rubybkp并解决问题

在此之后我运行ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"重新安装brew。

答案 1 :(得分:0)

此外,请注意,安装brew现在使用Bash:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Warning: The Ruby Homebrew installer is now deprecated and has been rewritten in Bash. 
Please migrate to the following command:
      /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"