博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
update Homebrew 太慢,更换Homebrew的更新源
阅读量:3938 次
发布时间:2019-05-23

本文共 1536 字,大约阅读时间需要 5 分钟。

更新源的选择
默认官方的更新源都是存放在GitHub上的,这也是中国大陆用户访问缓慢的原因,一般来说我们会更倾向选择国内提供的更新源,在此推荐中国科大以及清华大学提供的更新源。

替换更新源

# 替换brew.git:$ cd "$(brew --repo)"# 中国科大:$ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git# 清华大学:$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git# 替换homebrew-core.git:$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"# 中国科大:$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git# 清华大学:$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git# 替换homebrew-bottles:# 中国科大:$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile$ source ~/.bash_profile# 清华大学:$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile$ source ~/.bash_profile# 应用生效:$ brew update

如果你之前折腾过不少导致你的Homebrew有点问题,那么可以尝试使用如下方案:

# 诊断Homebrew的问题:$ brew doctor# 重置brew.git设置:$ cd "$(brew --repo)"$ git fetch$ git reset --hard origin/master# homebrew-core.git同理:$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"$ git fetch$ git reset --hard origin/master# 应用生效:$ brew update

重置更新源 某些时候也有换回官方源的需求

# 重置brew.git:$ cd "$(brew --repo)"$ git remote set-url origin https://github.com/Homebrew/brew.git# 重置homebrew-core.git:$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"$ git remote set-url origin https://github.com/Homebrew/homebrew-core.git

后记

完成更新源的更换后,我们可以使用
$ brew upgrade将现有的软件进行更新至最新版本,这样便能很直接的看出速度上的变化了。最后不要忘记$ brew cleanup将旧有的软件安装包进行清理

转载地址:http://bjywi.baihongyu.com/

你可能感兴趣的文章
CentOS 7系统上制作Clonezilla(再生龙)启动U盘并克隆双系统
查看>>
fail2ban的使用-控制连接数
查看>>
btkill-连接数控制
查看>>
NAT+www的发布
查看>>
dhcp.conf
查看>>
关于win10的升级
查看>>
cacti突然不显示流量
查看>>
发现一个好工具记录一下,U盘启动ISO文件。
查看>>
centos7下配置网卡以及查询网卡UUID
查看>>
适用于旧计算机的10款最佳轻量级Linux发行版
查看>>
在VMware Workstation中批量创建上千台虚拟机
查看>>
linux常用软件收集
查看>>
linux查看桌面环境
查看>>
centos8安装ntfs-3g后,不能自动挂载U盘(NTFS格式)
查看>>
Linux安装显卡驱动
查看>>
使用minicom
查看>>
linux常用外设-打印机指纹和蓝牙的安装管理
查看>>
记录一下安装在移动硬盘上的fedora linux v33在各种笔记本下的兼容性
查看>>
关于安装系统后不能启动的问题!
查看>>
U盘的挂载过程-先记录一下
查看>>