Mac安装Homebrew包管理器

ゞ 浴缸里的玫瑰 2023-02-23 07:44 82阅读 0赞

Mac安装Homebrew包管理器

  • 官网安装
  • 非官网安装(解决安装下载慢问题)
  • 解决homebrew源下载慢问题
  • Homebrew 常用命令

官网安装

  1. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

非官网安装(解决安装下载慢问题)

将官网中的install 文件下载到本地

  1. curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh >> brew_install.sh

homebrew官网

更改安装文件中源中的地址

找到下面命令

  1. BREW_REPO = "https://github.com/Homebrew/brew".freeze
  2. CORE_TAP_REPO = "https://github.com/Homebrew/homebrew-core".freeze

替换成清华大学镜像

  1. BREW_REPO = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git".freeze
  2. CORE_TAP_REPO = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git".freeze

执行安装命令

  1. /bin/bash brew_install.sh

解决homebrew源下载慢问题

替换homebrew使用阿里云的源

  1. # 替换brew.git:
  2. cd "$(brew --repo)"
  3. git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
  4. # 替换homebrew-core.git:
  5. cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
  6. git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git

替换成官方源

  1. # 重置brew.git:
  2. cd "$(brew --repo)"
  3. git remote set-url origin https://github.com/Homebrew/brew.git
  4. # 重置homebrew-core.git:
  5. cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
  6. git remote set-url origin https://github.com/Homebrew/homebrew-core.git

Homebrew 常用命令

  1. 查看homebrew版本信息
  2. # brew -v
  3. # 查看已安装的包列表
  4. brew list
  5. # 安装包
  6. brew install 包名
  7. # 卸载包
  8. brew uninstall 包名
  9. # 查找包
  10. brew search 包名
  11. # 查看包信息
  12. brew info 包名
  13. # 更新homebrew
  14. brew update
  15. # 诊断homebrew
  16. brew doctor
  17. # 查看帮助信息
  18. brew -h

发表评论

表情:
评论列表 (有 0 条评论,82人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Mac安装Homebrew

    简介 什么是Homebrew? 简单来说就是一个macOS(或Linux)的包管理器,可以用它来安装你需要的软件,方便卸载跟升级。 ![960557f7c

    相关 Mac安装Homebrew

    文章目录 1.官网获取下载命令 2.网络好~直接输入官网命令后就能安装好了 3.网络不好~看下面步骤 3.1

    相关 Mac 安装 Homebrew

    Mac 安装 Homebrew 1、Homebrew 怎么安装 。 安装,打开终端,复制粘贴,大约1分钟左右,下载完成,过程中需要输入密码,其他无需任何操作: