zl程序教程

您现在的位置是:首页 >  其他

当前栏目

mac安装homebrew

2023-03-20 14:57:09 时间

使用官方https://brew.sh/index_zh-cn的安装地址会存在问题,下面使用中科院的镜像来安装

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

Mac更新完系统后使用homebrew就报错:

使用brew upgrade后会重新更新homebrew-core

解决方法

删除homebrew-core后更新即可

cd /usr/local/Homebrew/Library/Taps/homebrew
rm -rf homebrew-core
brew upgrade