如果网速不给力或者比较着急安装homedrew,可用如下方法:
Homebrew官网获取安装指令,官网地址:https://brew.sh/
安装指令:/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
先从 https://raw.githubusercontent.com/Homebrew/install/master/install.sh 文件给下载下来(使用浏览器打开,另存为也可以),把文件命名为install.txt
然后,修改install.txt
文件:
BREW_REPO = 'https://github.com/Homebrew/brew'
改为:BREW_REPO = 'git@git.coding.net:homebrew/homebrew.git'
rm
命令,是为了防止之前安装Homebrew失败而残留的文件,导致这次安装失败
rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
如果没有权限,增加 sudo
sudo rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
/bin/bash install.txt (注意:shell当前路径最好为 install.txt所在路径)
输入brew help开始
输入brew doctor