08. brew 问题
1.brew 卸载
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
2.重新安装
# 重新安装
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# 更新
$ brew update
3.更新镜像
# 查看 brew的安装路径
$ brew --repo
# 进入brew 的安装路径
$ cd $PATH
$ git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask-versions.git
4.推荐安装
使用国外的安装,太慢了,而且总是失败!国内有很多牛人,简化国人的安装方式,如下
# 安装脚本
$ /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
# 卸载脚本
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"
A.现象
$ brew update
fatal: Could not resolve HEAD to a revision
# 解决方案
# 方案1
$ git -C $(brew --repository homebrew/core) checkout master
#方案2
$ git -C $(brew --repository homebrew/core) reset --hard HEAD.