MENU

macOS 安装 brew 失败

July 24, 2021 • MacOSX

1. 安装 brew 时走官方地址够呛

镜像地址安装:

/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"

中科大:https://lug.ustc.edu.cn/wiki/mirrors/help/brew.git

2. 替换国内源

2.1 替换 brew.git

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

2.2 替换 homebrew-core.git

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

2.3 替换 homebrew-cask.git(可选)

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

2.4 替换 homebrew-bottles(可选)

终端 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

3. Homebrew 组成

注:Homebrew 主要由四个部分组成: brew、homebrew-core 、homebrew-cask、homebrew-bottles,它们对应的功能如下:

组成功能
brew源代码仓库
homebrew-coreHomebrew 核心源
homebrew-cask提供macos应用和大型二进制文件的安装
homebrew-bottles预编译二进制软件包

4. Homebrew 基本用法

// 查询:
brew search 软件名
 
// 安装:
brew install 软件名
 
// 卸载:
brew uninstall 软件名
 
// 更新 Homebrew:
brew update 

// 查看 Homebrew 配置信息:
brew config

5. 卸载 homebrew

使用官方脚本同样会遇到uninstall地址无法访问问题,可以替换为下面脚本:

/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/uninstall)"

资料

https://www.cnblogs.com/joyce33/p/13376752.html