欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Mac安装brew及问题解决

程序员文章站 2022-07-03 18:05:53
...

1、打开终端、命令行执行: 

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

官方地址:https://brew.sh/index_zh-cn

 

Mac安装brew及问题解决

 

2、顺利情况下

Mac安装brew及问题解决

3 问题

 

Mac安装brew及问题解决

 

error: RPC failed; curl 18 transfer closed with outstanding read data remaining

fatal: the remote end hung up unexpectedly

fatal: early EOF

fatal: index-pack failed

Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1` exited with 128.

Error: Failure while executing; `/usr/local/bin/brew tap homebrew/core` exited with 1.

Failed during: /usr/local/bin/brew update --force

 

 

解决

依次执行

 

// 执行下面这句命令,更换为中科院的镜像:
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

// 把homebrew-core的镜像地址也设为中科院的国内镜像

cd "$(brew --repo)" 

git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" 

git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

// 更新
brew update

// 使用
brew install node

相关标签: brew