【问题标题】:How to reinstall brew on El Capitan?如何在 El Capitan 上重新安装 brew?
【发布时间】:2016-03-29 02:20:36
【问题描述】:

我坚持在 El Capitan 上重新安装 brew、ruby。

实际上我不记得它是如何发生的,但我丢失了我的 brew 并且我没有重新安装它。

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

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.

现在如何进行?

【问题讨论】:

  • 你能做一个which rubyruby --version 我想看看你用的是什么红宝石?
  • which ruby​​ /usr/local/bin/ruby ruby​​ --version ruby​​ 2.2.1p85(2015-02-26 修订版 49769)[x86_64-darwin12.6.0]
  • 你看过here吗?
  • 首先使用ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"卸载brew,然后使用ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"重新安装。
  • @mattexx,是的,我看过了。谢谢

标签: ruby homebrew osx-elcapitan


【解决方案1】:

我发现了问题。

我运行 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。

【讨论】:

  • 我运行了 curl 命令并被提示先卸载我现有的 brew:ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
【解决方案2】:

除此之外,只需注意现在安装 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)"

【讨论】:

    猜你喜欢
    • 2018-06-19
    • 2016-03-13
    • 2016-06-18
    • 2016-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-23
    • 2016-03-11
    相关资源
    最近更新 更多