macOS的Homebrew的mirror配置

类似ubuntu下面的apt-get或者centos的yum,Mac下也有类似的包管理工具。名字叫Homebrew

Homebrew安装方式:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

使用起来就很简单:

安装

brew install your_package_name

卸载

brew uninstall your_package_name

但是比如安装chrome或者iTerm就用Homebrew就不行了,这里有个工具叫Homebrew Cask

Homebrew Cask安装方式:

brew tap caskroom/cask

安装

brew cask install your_application

总所周知的原因,我们为了更好的食用,需要配置一下加速的mirror

这里推荐食用的是utsc mirror

  1. 替换Homebrew默认源

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

    cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    git remote set-url origin git://mirrors.ustc.edu.cn/homebrew-core.git
    
  3. 替换Bottles二进制源

    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
    
  4. 替换Cask源

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

    cd "$(brew --repo)/Library/Taps/caskroom/homebrew-cask
    git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
    
posted @ 2018-01-29 14:08  wynnzen  阅读(483)  评论(0编辑  收藏  举报