1. Homebrew简介
Homebrew: The Missing Package Manager for macOS (or Linux).
Homebrew installs the stuff you need that Apple (or your Linux system) didn’t.
Homebrew是Mac OSX上的软件包管理工具,简称brew。
2. 安装Homebrew
1 2 3
| /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
|
3. 更换Homebrew软件源
1 2 3 4 5 6 7 8 9
| cd "$(brew --repo)" && git remote set-url origin git://mirrors.ustc.edu.cn/brew.git cd "$(brew --repo homebrew/core)" && git remote set-url origin git://mirrors.ustc.edu.cn/homebrew-core.git cd "$(brew --repo homebrew/cask)" && git remote set-url origin git://mirrors.ustc.edu.cn/homebrew-cask.git brew update
cd "$(brew --repo)" && git remote set-url origin https://github.com/Homebrew/brew.git cd "$(brew --repo homebrew/core)" && git remote set-url origin https://github.com/Homebrew/homebrew-core.git cd "$(brew --repo homebrew/cask)" && git remote set-url origin https://github.com/Homebrew/homebrew-cask.git brew update
|
更多内容参考Homebrew/Linuxbrew 镜像使用帮助。
4. 使用Homebrew
4.1. 查找软件
4.2. 安装最新版软件
4.3. 安装指定版本软件
5. 更新Homebrew软件源
6. Error opening archive
6.1. 问题描述
使用国内brew源出现报错:
1
| tar: Error opening archive: Failed to open 'xxx.catalina.bottle.tar.gz'
|
6.2. 解决办法
暂时改回默认的brew源:
1 2 3
| unset HOMEBREW_BREW_GIT_REMOTE unset HOMEBREW_CORE_GIT_REMOTE unset HOMEBREW_BOTTLE_DOMAIN
|