macOS的Homebrew的mirror配置

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

Homebrew安装方式:github

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

使用起来就很简单:chrome

安装ubuntu

brew install your_package_name

卸载centos

brew uninstall your_package_name

可是好比安装chrome或者iTerm就用Homebrew就不行了,这里有个工具叫Homebrew Caskruby

Homebrew Cask安装方式:bash

brew tap caskroom/cask

安装app

brew cask install your_application

总所周知的缘由,咱们为了更好的食用,须要配置一下加速的mirrorcurl

这里推荐食用的是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