一.homebrew简介
Homebrew是一款Mac OS平台下的软件包管理工具,拥有安装、卸载、更新、查看、搜索等很多实用的功能。简单的一条指令,就可以实现包管理,而不用你关心各种依赖和文件路径的情况,十分方便快捷。官网
二.homebrew安装
1.国内安装方式:
终端执行以下命令:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
2.官网安装方式:
终端执行以下命令:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
三.homebrew卸载
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
四.更换为中科大源:
1.替换brew.git:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
2.替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
3.替换homebrew-cask.git:
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
4.更新:
brew update
五.还原为官方提供的仓库地址
1.替换brew.git:
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
2.替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
3.替换homebrew-cask.git:
4.删除环境变量
1.如果是bash
还原为官方提供的 homebrew-bottles 访问地址
open ~/.bash_profile
然后,删除 HOMEBREW_BOTTLE_DOMAIN 这一行配置
2.如果是zsh的话
还原为官方提供的 homebrew-bottles 访问地址
open ~/.zshrc
然后,删除 HOMEBREW_BOTTLE_DOMAIN 这一行配置
5.使更改生效
执行
brew update
然后重启终端。
其他文章:
https://blog.csdn.net/qq_32590631/article/details/90171101
https://blog.csdn.net/lijing742180/article/details/120643558