简单来说,Mac 上的 Homebrew 就是 Linux 上的 apt-get,一款软件包管理工具。

修改镜像

  1. echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"' >> ~/.zshrc
  2. echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"' >> ~/.zshrc

安装

  1. /bin/bash -c "$(curl -fsSL https://github.com/Homebrew/install/raw/HEAD/install.sh)"

卸载

  1. /bin/bash -c "$(curl -fsSL https://github.com/Homebrew/install/raw/HEAD/uninstall.sh)"

报错处理

homebrew-core is a shallow clone

image.png

  1. # 方法1
  2. git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
  3. # 方法2
  4. cd /usr/local/Homebrew/Library/Taps/homebrew
  5. rm -rf homebrew-core
  6. brew upgrade