文|Seraph
01 | brew
一、 替换/还原brew相关仓库
- 替换 / 还原 brew.git 仓库地址
cd "$(brew --repo)"
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git #阿里仓库地址
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git #中科大
git remote set-url origin https://github.com/Homebrew/brew.git #原仓库地址
- 替换 / 还原 homebrew-core.git 仓库地址
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git #阿里
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git #中科大
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
- 替换 / 还原 homebrew-bottles 访问地址
# bash终端
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile #阿里
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile #中科大
source ~/.bash_profile
二、brew问题解决
-
brew install过程中提示
Error: Permission denied @ apply2files - /usr/local/lib/docker/cli-plugins
。
解决:输入sudo chown -R $(whoami) $(brew --prefix)/*
-
安装homebrew时报错:
==> Downloading and installing Homebrew...
HEAD is now at 7fd508580 Merge pull request #12564 from Homebrew/dependabot/bundler/Library/Homebrew/sorbet-0.5.9452
error: Not a valid ref: refs/remotes/origin/master
fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
解决:先卸载homebrew,再重新安装。
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
02 | Xcode
一、xcodebuild
- 报错:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Deve
解决:使用sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
命令切换到xcode环境下。