1. 环境变量

      1. export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
      2. export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
      3. export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
      4. # 安装
      5. /bin/bash -c "$(curl -fsSL https://github.com/Homebrew/install/raw/master/install.sh)"
    2. 替换 Homebrew 镜像源

    (1) 替换 brew.git

    1. $ git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git

    (2) 替换 homebrew-core.git

    1. $ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
    1. 将官方源替换为清华大学的源

      1. export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
      2. brew tap --custom-remote --force-auto-update homebrew/core https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
      3. brew tap --custom-remote --force-auto-update homebrew/cask https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
      4. brew tap --custom-remote --force-auto-update homebrew/cask-fonts https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git
      5. brew tap --custom-remote --force-auto-update homebrew/cask-drivers https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-drivers.git
      6. brew tap --custom-remote --force-auto-update homebrew/cask-versions https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-versions.git
      7. brew tap --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git
      8. brew update
    2. 完成

    3. 重置还原 Homebrew 镜像源 ``` $ git -C “$(brew —repo)” remote set-url origin https://github.com/Homebrew/brew.git

    $ git -C “$(brew —repo homebrew/core)” remote set-url origin https://github.com/Homebrew/homebrew-core ```