【Mac】Homebrew

打印 上一主题 下一主题

主题 961|帖子 961|积分 2883

1、Homebrew 简介

官网地址:https://brew.sh
Homebrew 是一款Mac OS平台下的软件包管理工具,拥有安装、卸载、更新、查看、搜索等很多实用的功能。
Homebrew 主要有四个部门构成: brew、homebrew-core 、homebrew-bottles、homebrew-cask。
源说明brewHomebrew 源代码堆栈homebrew-coreHomebrew 核心软件堆栈homebrew-bottlesHomebrew 预编译二进制软件包homebrew-cask提供 macOS 应用和大型二进制文件 2、安装 Homebrew

下边三种下令任选一条下令实行即可:
  1. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
复制代码
  1. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
复制代码
  1. /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)
  2. source ~/.zprofile
复制代码
3、卸载 Homebrew

  1. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
复制代码
4、Homebrew 下令

下令说明brew -v查看版本brew -h查看资助信息brew help查看资助信息brew list列出已安装的软件包brew update更新 homebrewbrew outdated列出可以更新的软件包brew upgrade更新所有安装过的软件包brew upgrade git更新指定的软件包brew search git查找软件包brew install git安装软件包brew remove git卸载软件包brew info git查看软件包信息brew deps git列出软件包的依靠关系 5、修改 Homebrew 源

5.1 阿里源

  1. # 查看 brew.git 当前源
  2. $ cd "$(brew --repo)" && git remote -v
  3. origin    https://github.com/Homebrew/brew.git (fetch)
  4. origin    https://github.com/Homebrew/brew.git (push)
  5. # 查看 homebrew-core.git 当前源
  6. $ cd "$(brew --repo homebrew/core)" && git remote -v
  7. origin    https://github.com/Homebrew/homebrew-core.git (fetch)
  8. origin    https://github.com/Homebrew/homebrew-core.git (push)
  9. # 修改 brew.git 为阿里源
  10. $ git -C "$(brew --repo)" remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
  11. # 修改 homebrew-core.git 为阿里源
  12. $ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
  13. # zsh 替换 brew bintray 镜像
  14. $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
  15. $ source ~/.zshrc
  16. # bash 替换 brew bintray 镜像
  17. $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
  18. $ source ~/.bash_profile
  19. # 刷新源
  20. $ brew update
复制代码
5.2 清华源

  1. # 替换各个源
  2. $ git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
  3. $ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
  4. $ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
  5. # zsh 替换 brew bintray 镜像
  6. $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
  7. $ source ~/.zshrc
  8. # bash 替换 brew bintray 镜像
  9. $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
  10. $ source ~/.bash_profile
  11. # 刷新源
  12. $ brew update
复制代码
5.3 中科大源

  1. # 替换各个源
  2. $ git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
  3. $ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
  4. $ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
  5. # zsh 替换 brew bintray 镜像
  6. $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
  7. $ source ~/.zshrc
  8. # bash 替换 brew bintray 镜像
  9. $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
  10. $ source ~/.bash_profile
  11. # 刷新源
  12. $ brew update
复制代码
5.4 官方源(重置)

  1. # 重置 brew.git 为官方源
  2. $ git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
  3. # 重置 homebrew-core.git 为官方源
  4. $ git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
  5. # 重置 homebrew-cask.git 为官方源
  6. $ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask
  7. # zsh 注释掉 HOMEBREW_BOTTLE_DOMAIN 配置,其实就是加个#,也可用nano
  8. $ vi ~/.zshrc
  9. # export HOMEBREW_BOTTLE_DOMAIN=xxxxxxxxx
  10. # bash 注释掉 HOMEBREW_BOTTLE_DOMAIN 配置,其实就是加个#,也可用nano
  11. $ vi ~/.bash_profile
  12. # export HOMEBREW_BOTTLE_DOMAIN=xxxxxxxxx
  13. # 刷新源
  14. $ brew update
复制代码
10、参考资料



  • Mac 下 brew 源切换
  • Mac软件包管理

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

忿忿的泥巴坨

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表