Homebrew 使用

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

修改镜像

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

安装

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

卸载

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

报错处理

homebrew-core is a shallow clone

# 方法1
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow

# 方法2
cd /usr/local/Homebrew/Library/Taps/homebrew
rm -rf homebrew-core
brew upgrade
目录