brew 使用

一、查看brew的安装目录

cd "$(brew --repo)"
pwd

在这里插入图片描述

二、查看当前源

cd "$(brew --repo)"
git remote -v 

在这里插入图片描述
可以看到当前brew的国内源是中科大的镜像

三、设置homebrew的源

Homebrew主要由4个部分组成:

brew: 源代码仓库
homebrew-core: 核心软件仓库
homebrew-bottles: 预编译二进制软件包
homebrew-cask: MacOS客户端应用

以 USTC(中科院)镜像为例:

  1. 替换 Homebrew 源
$ cd "$(brew --repo)"
$ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
  1. 切换 Homebrew Core 源
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
  1. 切换 Homebrew Cask 源
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask"
$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

设置源的参考文档:
http://mirrors.ustc.edu.cn/help/brew.git.html

根据使用的shell,这里以zsh为例:
编辑 ~/.zshrc 添加如下内容

export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
export HOMEBREW_BREW_GIT_REMOTE=https://mirrors.ustc.edu.cn/brew.git
export HOMEBREW_CORE_GIT_REMOTE=https://mirrors.ustc.edu.cn/homebrew-core.git

调用source命令使配置文件生效,然后更新 brew

source ~/.zshrc
brew update

四、查看homebrew的版本

brew --version

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值