HomeBrew 修改镜像源

HomeBrew 修改镜像源

查看当前源

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

替换源

清华大学镜像站

git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
//  更新
brew update

中科大镜像站

// 替换 Homebrew
git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
// 替换 Homebrew Core
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
// 替换 Homebrew Cask
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
# 更新
brew update

还原

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

修改bottles

清华

# 对于 bash 用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

# 对于 zsh 用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

中科大

# 对于 bash 用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

# 对于 zsh 用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

还原

1. 注释掉bash配置文件里的有关Homebrew Bottles
即可恢复官方源
2. 重启bash或让bash重读配置文件。

常用命令

#查看版本
brew -v

#查询软件
brew search 软件名

#安装软件
brew install 软件名

#后台运行的软件(重启之后可以自动启动)
brew services start|stop|restart 软件名

#卸载软件
brew uninstall 软件名

#查看包信息
brew info [包名]

#查看安装了哪些软件
brew list 软件名

# 检查brew能否正常工作
brew doctor

# 更新brew包
brew update

# 查询可更新的包
brew outdated

# 更新所有[指定包]
brew upgrade [包名]

# 清理旧版本
//清理所有包的旧版本
brew cleanup 

//清理指定包的旧版本
brew cleanup [包名]

//查看可清理的旧版本包,不执行实际操作
brew cleanup -n 

# 锁定不想更新的包
//锁定某个包
brew pin $FORMULA  
//取消锁定
brew unpin $FORMULA 

#查看帮助
brew help

# 在浏览器端打开 Homebrew 官网
brew home 

# 显示包的依赖信息
brew deps [包名]

reference

  • https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/
  • https://mirrors.ustc.edu.cn/help/index.html
  • https://juejin.cn/post/6844903975695679495
  • https://www.cnblogs.com/tonglin0325/p/12314093.html
  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值