当前位置:   article > 正文

HomeBrew 修改镜像源_brew设置镜像源

brew设置镜像源

HomeBrew 修改镜像源

查看当前源

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

替换源

清华大学镜像

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

中科大镜像站

// 替换 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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

还原

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

修改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

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

中科大

# 对于 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
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

还原

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

常用命令

#查看版本
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 [包名]

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58

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
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/381781
推荐阅读
相关标签
  

闽ICP备14008679号