Mac下更换Homebrew源

柯里磷火
• 阅读 5191

默认Homebrew的源会使用Github,国内使用会很慢。可以通过更改为国内的源,提高访问速度。

Step 1 先重置一下(原理就是重置一下brew.git和homebrew-core.git)

# 诊断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 

Step 2 使用国内的源

# 替换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

Step 3清理旧的安装包

$ brew cleanup

如果想换回官方源使用如下命令

$ cd "$(brew --repo)"
$ git remote set-url origin https://github.com/Homebrew/brew.git

$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
$ git remote set-url origin https://github.com/Homebrew/homebrew-core.git
点赞
收藏
评论区
推荐文章
Wesley13 Wesley13
3年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
美凌格栋栋酱 美凌格栋栋酱
6个月前
Oracle 分组与拼接字符串同时使用
SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(
洛竹 洛竹
4年前
我的 Mac 开发环境
Homebrew访问安装。使用Homebrew安装Apple(或您的Linux系统)没有预装但。Homebrew将大大降低维护环境的时间。本文后面将尽可能使用Homebrew。brewinstall:安装brewuninstall:卸载brewupdate:更新homebrewbrewupgr
Stella981 Stella981
3年前
Mac下安装mongdb
使用homebrew安装MongoDB:brewinstallmongodb这时MongoDB将被安装在/usr/local/Cellar/mongodb/4.0.3\_1(我的MongoDB版本是4.0.3\_1)3.配置MongoDB:安装完MongoDB后,需要配置一下MongoDB
Stella981 Stella981
3年前
CentOS配置本地Yum源、阿里云Yum源、163Yum源、并配置Yum源的优先级
一、用Centos镜像搭建本地Yum源由于安装centos后的默认Yum源为centos的官方地址,所以在国内使用很慢甚至无法访问,所以一般的做法都是把默认的Yum源替换成aliyun的Yum源或者163等国内的Yum源(下文介绍如何配置)。 但是以上的方法都是需要网络的,当没有网络的时候就无法使用了,所以还有一
Stella981 Stella981
3年前
Mac下 Docker部署SpringBoot应用
一、安装Docker环境使用Homebrew安装macOS我们可以使用Homebrew来安装Docker。Homebrew的Cask已经支持DockerforMac,因此可以很方便的使用HomebrewCask来进行安装:$brewcaskin
Stella981 Stella981
3年前
Mac上Homebrew的使用 (Homebrew 使 OS X 更完整)
0Homebrew是啥?“HomebrewinstallsthestuffyouneedthatAppledidn’t.——Homebrew使OSX更完整”。Homebrew的官网\1\(https://www.oschina.net/action/GoToLink?urlh
Stella981 Stella981
3年前
Mac下Homebrew的安装与使用
Homebrew简介,安装与使用简介Homebrew官方网站(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fbrew.sh%2Findex_zhcn.html)Homebrew是一个包管理器,用于安装Apple没有预装但你
Stella981 Stella981
3年前
MacOS在没有安装xcode情况下使用homebrew
当没有xcode时,我们使用homebrew会提示出错。Error:Failurewhileexecuting:/usr/bin/otoolL/usr/bin/install\_name\_tool或者出现Error:The/usr/localdirectoryisnotwritable.Evenifthisd
Stella981 Stella981
3年前
Mac OS X 的包管理器 HomeBrew
Homebrew是最简单和灵活的方式,用来在MacOSX安装Linux工具包。Homebrew国内高速安装脚本:https://gitee.com/cunkai/HomebrewCN(https://gitee.com/cunkai/HomebrewCN)安装过程很简单:ruby e "$(curl f
Stella981 Stella981
3年前
Mac安装Redis
使用Homebrew安装Redis(1)安装命令brew install redis(2)查看软件安装及配置文件位置Homebrew安装的软件会默认在/usr/local/Cellar/路径下;redis的配置文件redis.conf存放在/usr/loca
柯里磷火
柯里磷火
Lv1
岁夜高堂列明烛,美酒一杯声一曲
文章
3
粉丝
0
获赞
0