安装 homebrew 2022.07.13

Homebrew 的官方网站 https://brew.sh/

1. 设置 USTC 的镜像

HOMEBREW_CORE_GIT_REMOTE=https://mirrors.ustc.edu.cn/homebrew-core.git

2. 安装 homebrew

执行以下命令

/bin/bash -c "$(curl -fsSL <https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh>)"

3. 添加 Homebrew 到环境变量

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/$whoiam/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

brew update 的错误

fatal: Could not resolve HEAD to a revision

rm -rf $(brew --repo homebrew/core)
brew tap homebrew/core

替换国内镜像源

https://blog.csdn.net/m0_50324291/article/details/108564732

/bin/zsh -c "$(curl -fsSL <https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh>)"

fatal: not in a git directory Error: Command failed with exit 128: git

fatal: not in a git directory Error: Command failed with exit 128: git