Homebrew不兼容(只支持macOS的正式发行版本)。报错如下:
Traceback (most recent call last):
11: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `<main>'
10: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative'
9: from /usr/local/Homebrew/Library/Homebrew/global.rb:29:in `<top (required)>'
8: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
6: from /usr/local/Homebrew/Library/Homebrew/os.rb:3:in `<top (required)>'
5: from /usr/local/Homebrew/Library/Homebrew/os.rb:21:in `<module:OS>'
4: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:58:in `prerelease?'
3: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `version'
2: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `new'
1: from /usr/local/Homebrew/Library/Homebrew/os/mac/version.rb:26:in `initialize'
/usr/local/Homebrew/Library/Homebrew/version.rb:368:in `initialize': Version value must be a string; got a NilClass () (TypeError)
两种解决方案:
1、安装最新版本的Command Line tools, 前往此处下载
2、Version写死
打开报错路径文件
cd /usr/local/Homebrew/Library/Homebrew
open version.rb
找到版本判断逻辑并替换
@version = val.to_str
替换为
@version = '<SystemVersion>'
网友评论