AngusWong's 博客

  • 首页
  • Linux
  • Mac
  • PHP
  • 数据库
  • 路由相关
专注于计算机相关技术分享
  1. 首页
  2. Mac
  3. 正文

Mac 安装 homebrew 并修改为国内源

2021年2月3日 9370点热度 0人点赞 0条评论

1、安装

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

2、切换为清华源

cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
brew update

3、替换homebrew-cask默认源

# 修改为中科大的
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask"
git remote set-url origin git://mirrors.ustc.edu.cn/homebrew-cask.git

4、替换 Homebrew-bottles默认源

# 临时替换
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles

# 永久替换
# bash
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# zsh
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

 

其他国内源
# 中国科大:
https://mirrors.ustc.edu.cn/brew.git
https://mirrors.ustc.edu.cn/homebrew-core.git
https://mirrors.ustc.edu.cn/homebrew-bottles

# 清华大学:
https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles

# ali
https://mirrors.aliyun.com/homebrew/brew.git
https://mirrors.aliyun.com/homebrew/homebrew-core.git
https://mirrors.aliyun.com/homebrew/homebrew-bottles

重置回官方源[/info

# 重置 brew.git 为官方源
$ git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git

# 重置 homebrew-core.git 为官方源
$ git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git

# 重置 homebrew-cask.git 为官方源
$ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask

# zsh 注释掉 HOMEBREW_BOTTLE_DOMAIN 配置
$ vi ~/.zshrc
# export HOMEBREW_BOTTLE_DOMAIN=xxxxxxxxx

# bash 注释掉 HOMEBREW_BOTTLE_DOMAIN 配置
$ vi ~/.bash_profile
# export HOMEBREW_BOTTLE_DOMAIN=xxxxxxxxx

# 刷新源
$ brew update
查看当前Homebrew源
# brew.git镜像源
git -C "$(brew --repo)" remote -v

# homebrew-core.git镜像源
git -C "$(brew --repo homebrew/core)" remote -v

# homebrew-cask.git镜像源
git -C "$(brew --repo homebrew/cask)" remote -v

 

标签: homebrew 国内源
最后更新:2021年2月3日

Sean

这个人很懒,什么都没留下

点赞
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复
分类
  • Linux
  • Mac
  • PHP
  • 其他
  • 前端
  • 数据库
  • 路由相关
最新 热点 随机
最新 热点 随机
macOS Sonoma, macOS Sequoia删除Mac启动台里删不掉的图标 PVE8修改软件仓库源和 CT模板(LXC)源为国内源 Debian12更换国内源 构建宝塔面板Docker镜像 无需root!卸载小米电视/盒子内置应用 检查系统是否被入侵
Vue混入mixin macOS Sonoma, macOS Sequoia删除Mac启动台里删不掉的图标 Composer 国内镜像设置 重新编译PHP让宝塔面板curl支持http2 Linux 添加普通用户,并加入管理员用户组wheel Yapi二次开发后重新打包发布

COPYRIGHT © 2021 huangyuqiang.cn. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang