Mac安装HomeBrew踩坑笔记整理

2020-02-24  本文已影响0人  Mr_Arvin
  1. 首先第一种(最简单的,但只适用于能翻墙的玩家):直接复制官方的安装命令即可.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2.第二种可以完美安装

curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install

此处需要保证GitHub的资源域名raw.githubusercontent.com能够正常访问,但大多情况下是访问不了的,通常是因为DNS污染导致的,可以通过手动修改hosts文件解决。https://www.ipaddress.com/可通过这个网站获取到真实地址,然后手动修改到hosts里面即可。

BREW_REPO = “https://github.com/Homebrew/brew“.freeze
更改为
BREW_REPO = “git://mirrors.ustc.edu.cn/brew.git“.freeze
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

git clone git://mirrors.ustc.edu.cn/homebrew-cask.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask --depth=1
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
cd "$(brew --repo)/Library/Taps/caskroom/homebrew-cask"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
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
上一篇 下一篇

猜你喜欢

热点阅读