Homebrew 是一款自由及开放源代码的软件包管理系统,用以简化 macOS 和 linux 系统上的软件安装过程。它拥有安装、卸载、更新、查看、搜索等很多实用的功能,通过简单的一条指令,就可以实现包管理
Homebrew 主要有四个部分组成: brew、homebrew-core 、homebrew-bottles、homebrew-cask
查看 brew.git 当前源
? ~ cd "$(brew --repo)" && git remote -v
origin https://github.com/Homebrew/brew (fetch)
origin https://github.com/Homebrew/brew (push)
修改 brew.git 为阿里源
? homebrew-core git:(master) git -C "$(brew --repo)" remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
查看 homebrew-core.git 当前源
? Homebrew git:(stable) cd "$(brew --repo homebrew/core)" && git remote -v
origin https://github.com/Homebrew/homebrew-core (fetch)
origin https://github.com/Homebrew/homebrew-core (push)
修改 homebrew-core.git 为阿里源
? homebrew-core git:(master) git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
当我想修改 homebrew-cask.git 为阿里源///这里是个坑,阿里不提供这个 哈。
浏览器直接,也没有看到homebrew-cask,因此我这里用USTC 镜像
https://mirrors.aliyun.com/homebrew/
../
brew.git/ 24-Aug-2020 15:01 -
homebrew-bottles/ 18-Mar-2020 01:51 -
homebrew-core.git/ 29-Oct-2020 15:00 -
https://mirrors.ustc.edu.cn/help/homebrew-cask.git.html
替换为 USTC 镜像:
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
重置为官方地址:
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://github.com/Homebrew/homebrew-cask
? homebrew-core git:(master) cd
设置环境变量
zsh 替换 brew bintray 镜像,zsh如下
? ~ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
? ~ source ~/.zshrc
? ~ brew update
Already up-to-date.
# bash 替换 brew bintray 镜像
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile
macOS Big Sur
? ~ brew install brew-cask-completion
Updating Homebrew...
==> Downloading https://github.com/xyb/homebrew-cask-completion/archive/v2.1.tar.gz
==> Downloading from https://codeload.github.com/xyb/homebrew-cask-completion/tar.gz/v2.1
######################################################################## 100.0%
Error: Your CLT does not support macOS 11.
It is either outdated or was modified.
Please update your CLT or delete it if no updates are available.
Update them from Software Update in System Preferences or run:
softwareupdate --all --install --force
If that doesn't show you an update run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
Alternatively, manually download them from:
https://developer.apple.com/download/more/.
Error: An exception occurred within a child process:
SystemExit: exit
? ~ sudo rm -rf /Library/Developer/CommandLineTools
? ~ sudo xcode-select --install
xcode-select: note: install requested for command line developer tools
? ~ /usr/bin/xcodebuild -version
Xcode 12.2
Build version 12B45b
? ~ brew install brew-cask-completion
Updating Homebrew...
==> Downloading https://github.com/xyb/homebrew-cask-completion/archive/v2.1.tar.gz
Already downloaded: /Users/lex/Library/Caches/Homebrew/downloads/553cb51ee8b546a44248737f15780038917054852f645835569ced65f935b6f0--homebrew-cask-completion-2.1.tar.gz
/usr/local/Cellar/brew-cask-completion/2.1_1: 5 files, 11.1KB, built in 4 seconds
==> `brew cleanup` has not been run in 30 days, running now...
Removing: /usr/local/Cellar/ghostscript/9.52... (671 files, 87.4MB)
Removing: /usr/local/Cellar/ghostscript/9.53.2... (668 files, 89.1MB)
Removing: /Users/lex/Library/Caches/Homebrew/gping--0.1.7.big_sur.bottle.tar.gz... (854.8KB)
Removing: /usr/local/Cellar/libomp/10.0.1... (9 files, 1.3MB)
Removing: /usr/local/Cellar/openssl@1.1/1.1.1g... (8,059 files, 18MB)
Removing: /Users/lex/Library/Caches/Homebrew/prometheus--2.22.1.catalina.bottle.tar.gz... (61.4MB)
Removing: /Users/lex/Library/Logs/Homebrew/switchaudio-osx... (64B)
Pruned 14 symbolic links and 6 directories from /usr/local
解决报错
本文暂时没有评论,来添加一个吧(●'◡'●)