标签: zsh

  • Mac下的brew切换到国内的镜像源

    Mac下的brew切换到国内的镜像源

    homebrew虽好,但是GFW的原因,你懂的,用起来非常的。。慢 brew update也永远更新不上 今天要装个mongodb,实在受不了了,换可中科大的源,然后飞快。   直接上链接

    homebrew主要分两部分:git repo(位于GitHub)和二进制bottles(位于bintray),这两者在国内访问都不太顺畅。可以替换成国内的镜像,git repo国内镜像就比较多了,可以自行查找,提供二进制镜像的:

    • 中科大镜像(中科大的镜像做的太好了!)

    替换homebrew默认源 [LUG@USTC]
    替换homebrew bottles默认源 [LUG@USTC]

    当然,也可以不打开链接,直接按照下面的方法在终端里敲即可.

    替换homebrew默认源

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

    Homebrew Bottles源

    Homebrew Bottles是Homebrew提供的二进制代码包,目前镜像站收录了以下仓库:

    • homebrew/homebrew-core
    • homebrew/homebrew-dupes
    • homebrew/homebrew-games
    • homebrew/homebrew-gui
    • homebrew/homebrew-python
    • homebrew/homebrew-php
    • homebrew/homebrew-science
    • homebrew/homebrew-versions
    • homebrew/homebrew-x11

    使用方法

    bash用户

    echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
    source ~/.bash_profile

    zsh用户

    echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
    source ~/.zshrc

    完成上面两个源的替换后,记得brew update更新一下。

    更新系统,并显示进度

    brew upgrade --verbose
WeChat
↑