跳到主要内容
方的代码随记
返回

Homebrew 安装与国内镜像配置

更新于:

安装脚本

Mac 标准安装脚本(推荐,功能全面,速度略慢):

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

Mac 极速安装脚本(安装快,但 update 功能需要命令修复):

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" speed

Linux 标准安装脚本:

rm Homebrew.sh ; wget https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh ; bash Homebrew.sh

Mac 卸载脚本:

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"

Linux 卸载脚本:

rm HomebrewUninstall.sh ; wget https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh ; bash HomebrewUninstall.sh

替换为国内源

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

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

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

可用镜像源

源地址
中科大https://mirrors.ustc.edu.cn/brew.git
清华https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
阿里https://mirrors.aliyun.com/homebrew/brew.git
腾讯https://mirrors.cloud.tencent.com/homebrew/brew.git

常见问题

Git 报 dubious ownership 时,把目录加入安全列表:

git config --global --add safe.directory <目录路径>

分享这篇文章:

上一篇
JS / CSS 压缩工具选型
下一篇
Git 与 yum 的证书错误处理