文章目录
  • ↑标题
  • ↓评论
  • Homebrew|源的查看、修改和复原

    #Homebrew手册 穿卡芦苇

    更新 Homebrew 自身的源

    举例,

    修改为清华大学的镜像源

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

    复原为官方的源:

    git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git

    安装和更新软件包的源 Homebrew-bottles

    该镜像是 Homebrew 二进制预编译包的镜像。也就是我们用brew install 安装软件时,软件包下载的位置

    修改为清华大学的镜像源

    # 以下针对 mac OS 系统上的 Homebrew
    git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
    git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
    git -C "$(brew --repo homebrew/cask-fonts)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git
    git -C "$(brew --repo homebrew/cask-drivers)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-drivers.git
    git -C "$(brew --repo homebrew/cask-versions)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-versions.git
    
    # 以下针对 Linux 系统上的 Linuxbrew
    git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/linuxbrew-core.git
    
    # 更换后测试工作是否正常
    brew update
    

    复原为官方的源

    # 以下针对 mac OS 系统上的 Homebrew
    git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
    git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git
    git -C "$(brew --repo homebrew/cask-fonts)" remote set-url origin https://github.com/Homebrew/homebrew-cask-fonts.git
    git -C "$(brew --repo homebrew/cask-drivers)" remote set-url origin https://github.com/Homebrew/homebrew-cask-drivers.git
    git -C "$(brew --repo homebrew/cask-versions)" remote set-url origin https://github.com/Homebrew/homebrew-cask-versions.git
    
    # 以下针对 Linux 系统上的 Linuxbrew
    git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/linuxbrew-core.git
    
    # 更换后测试工作是否正常
    brew update
    

    参考:https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/


    (正文结束。芝士就是力量!