目录

安装

brew install putty

FAQ

1、Updating Homebrew… 卡住

$ brew install putty
Updating Homebrew...
  • 方法1:直接关闭brew每次执行命令时的自动更新
    $ vim ~/.bash_profile
    
    export HOMEBREW_NO_AUTO_UPDATE=true
    
    $ source ~/.bash_profile
    
  • 方法2:替换brew源
    cd "$(brew --repo)"
    git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/brew.git
    cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew-core.git
    brew update
    

2、`initialize’: Version value must be a string; got a NilClass () (TypeError)

$ brew install putty
/usr/local/Homebrew/Library/Homebrew/version.rb:368:in `initialize': Version value must be a string; got a NilClass () (TypeError)
	from /usr/local/Homebrew/Library/Homebrew/os/mac/version.rb:26:in `initialize'
	from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `new'
	from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `version'
	from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:58:in `prerelease?'
	from /usr/local/Homebrew/Library/Homebrew/os.rb:21:in `<module:OS>'
	from /usr/local/Homebrew/Library/Homebrew/os.rb:3:in `<top (required)>'
	from /usr/local/Homebrew/Library/Homebrew/global.rb:28:in `require'
	from /usr/local/Homebrew/Library/Homebrew/global.rb:28:in `<top (required)>'
	from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative'
	from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `<main>'
  • 方法:打开version.rb,定位到368行,进行如何编辑。
    $ vim /usr/local/Homebrew/Library/Homebrew/version.rb
    
    def initialize(val)
      #raise TypeError, "Version value must be a string; got a #{val.class} (#{val})" unless val.respond_to?(:to_str)
    
      #@version = '10.14.1'
      @version = '11.2.1'
    end
    

3、Error: Failed to upgrade Homebrew Portable Ruby!

$ brew uninstall putty
==> Downloading https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.6.3_2.yosemite.bottle.tar.gz
Already downloaded: /Users/wjj/Library/Caches/Homebrew/portable-ruby-2.6.3_2.yosemite.bottle.tar.gz
Error: Checksum mismatch.
Expected: b065e5e3783954f3e65d8d3a6377ca51649bfcfa21b356b0dd70490f74c6bd86
  Actual: d3b23d015346282ec081e6a6b3034b6753967076ac833b2b5182d2c074404842
 Archive: /Users/wjj/Library/Caches/Homebrew/portable-ruby-2.6.3_2.yosemite.bottle.tar.gz
To retry an incomplete download, remove the file above.
Error: Failed to upgrade Homebrew Portable Ruby!
  • 方法:删除文件
    rm -rf /Users/wjj/Library/Caches/Homebrew/portable-ruby-2.6.3_2.yosemite.bottle.tar.gz
    

参考资料