本人的Mac电脑按照清华大学开源软件镜像站的设置时报错如下:

  1. git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
  2. fatal: cannot change to '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask': No such file or directory

解决方案是先change到对应的目录下,在执行替换脚本,操作如下:

  1. cd "$(brew --repo)"
  2. git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
  3. cd $(brew --repo homebrew/core)
  4. git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

卸载homebrew

执行卸载脚本:

  1. sudo /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

如果报错如下:

  1. curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

需要配置一下host;去往https://www.ipaddress.com/,输入raw.githubusercontent.com查看ip地址,然后配置host之后重试。

安装bash_completion

卸载homebrew后发现自动补全的功能也没有了,报错如下:

  1. vi awk: can't open file /usr/local/etc/bash_completion

解决方法是重新安装homebrew后,安装bash-completion:

  1. brew install bash-completion