MAC brew 无法工作报错

brew 操作报出类似如下的错误:

brew install coreutils

Error: coreutils: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/coreutils.rb:73: syntax error, unexpected << def caveats; <<~EOS

/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/coreutils.rb:77: syntax error, unexpected tIDENTIFIER, expecting keyword_end
can add a "gnubin" directory to your PATH from your bashrc like:

/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/coreutils.rb:77: syntax error, unexpected ':', expecting keyword_end
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/coreutils.rb:79: dynamic constant assignment
    PATH="#{opt_libexec}/gnubin:$PATH"
         ^
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/coreutils.rb:81: dynamic constant assignment
Additionally, you can access their man pag...
             ^
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/coreutils.rb:81: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('
Additionally, you can access their man pages with ...
                     ^
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/coreutils.rb:82: syntax error, unexpected tIDENTIFIER, expecting keyword_end
the "gnuman" directory to your MANPATH from your bashrc as well:
                      ^
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/coreutils.rb:82: syntax error, unexpected ':', expecting keyword_end
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/coreutils.rb:84: dynamic constant assignment
    MANPATH="#{opt_libexec}/gnuman:$MANPATH"`

解决方案:

rm -rf /usr/local/Homebrew/.git
brew update
brew config

https://github.com/Homebrew/brew/issues/3353

你可能感兴趣的:(MAC brew 无法工作报错)