最近换电脑了,发现homebrew 安装不上了,我感觉是网络问题,连了个vpn,发现还是不行,哈哈,是姿势不对
安装
运行下面自动脚本(已经全部替换为国内地址):
(Mac)常规安装脚本(推荐 完全体 几分钟安装完成)
代码语言:javascript复制/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
(Mac)精简版 几秒钟安装完成
代码语言:javascript复制/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" speed
(Mac)卸载脚本
代码语言:javascript复制/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"
(Linux)安装脚本:
代码语言:javascript复制rm Homebrew.sh ; wget https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh ; bash Homebrew.sh
(Linux)卸载脚本:
代码语言:javascript复制rm HomebrewUninstall.sh ; wget https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh ; bash HomebrewUninstall.sh
安装问题
如果发现有各种安装不上的 运行:
代码语言:javascript复制sudo rm -rf /usr/local/Homebrew
提示系统太旧的 (Failed to install Homebrew Portable Ruby (and your system version is too old)!) 运行:
代码语言:javascript复制HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles-portable-ruby
rm -rf /Users/$(whoami)/Library/Caches/Homebrew/
brew update
切换镜像源
homebrew
配置方法:[https://developer.aliyun.com/mirror/homebrew]。
代码语言:javascript复制# 替换brew.git:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.aliyun.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
# 应用生效
brew update
# 替换homebrew-bottles:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
腾讯云 homebrew
配置方法:Homebrew 镜像使用帮助 [https://mirrors.cloud.tencent.com/help/homebrew.html]。
代码语言:javascript复制cd "$(brew --repo)"
git remote set-url origin http://mirrors.cloud.tencent.com/git/homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin http://mirrors.cloud.tencent.com/git/homebrew/homebrew-core.git
brew update
配置方法:Homebrew-bottles 镜像使用帮助 [https://mirrors.cloud.tencent.com/help/homebrew-bottles.html]。
代码语言:javascript复制echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.cloud.tencent.com/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
中科大 homebrew
配置方法:Homebrew 源使用帮助[http://mirrors.ustc.edu.cn/help/brew.git.html]。
代码语言:javascript复制cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
配置方法:Homebrew Core 源使用帮助[http://mirrors.ustc.edu.cn/help/homebrew-core.git.html]。
代码语言:javascript复制cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
配置方法:Homebrew Bottles 源使用帮助[http://mirrors.ustc.edu.cn/help/homebrew-bottles.html]。
代码语言:javascript复制echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile