Site icon moneyslow.com

Mac下如何查看Homebrew源配置并进行修改或者改回默认值

homebrew是macOS(或 Linux)缺失的软件包的管理器

homebrew是macOS(或 Linux)缺失的软件包的管理器

Homebrew的配置分成三个目录,分别是

1、brew(brew --repo)
2、homebrew/core(brew --repo homebrew/core)
3、homebrew/cask(brew --repo homebrew/cask)

Homebrew查看源配置
在目录中可以通过git remote get-url origin来查看当前的源的URL。

 ~ % git -C "$(brew --repo)" remote get-url origin
https://mirrors.ustc.edu.cn/brew.git
 ~ % git -C "$(brew --repo homebrew/core)" remote get-url origin
https://mirrors.ustc.edu.cn/homebrew-core.git
 ~ % git -C "$(brew --repo homebrew/cask)" remote get-url origin
https://mirrors.ustc.edu.cn/homebrew-cask.git

可以通过以下三个命令设置为默认值,最后需要更新

git -C "$(brew --repo)" remote set-url origin 'https://github.com/Homebrew/brew.git'
git -C "$(brew --repo homebrew/core)" remote set-url origin 'https://github.com/Homebrew/homebrew-core.git'
git -C "$(brew --repo homebrew/cask)" remote set-url origin 'https://github.com/Homebrew/homebrew-cask.git'

brew update

更多详细细节,可以参考清华帖子:
https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/

Exit mobile version