OS X El Capitan版本10.11.2

我尝试brew update,但显示此错误消息。

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mach (LoadError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/Library/Homebrew/extend/pathname.rb:2:in `<top (required)>'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/Library/Homebrew/global.rb:3:in `<top (required)>'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/Library/brew.rb:15:in `<main>'


我也尝试了brew install zsh,但是显示了以上消息。

请让我知道如何解决此错误消息。

最佳答案

在这里找到了对我有用的答案:https://stackoverflow.com/a/35495897/1354137


该问题主要发生在将OS X更新为El Capitan(OS X 10.11)之后。这主要是因为文件El Capitan的new SIP process的文件权限问题。尝试更改/ usr / local目录的权限。

$ sudo chown -R $(whoami):admin /usr/local


如果仍然无法使用,请使用以下步骤,一切都会好起来。这可能是因为未更新自制软件。

1. open terminal
2. $ cd /usr/local
3. $ git reset --hard
4. $ git clean -df
5. $ brew update

09-04 18:05