备注:建议全程挂,执行export http_proxy=http://127.0.01:1080或者https_proxy=127.0.0.1:1087 需要执行的命令或者参考下文的备注;

brew

官方安装方式命令:

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

接下来特别慢,需要等。
结束后可能会报错:

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.

解决/换源

// 执行下面这句命令,更换为中科院的镜像:
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

即可安装完毕

小结:常用命令记录

$FORMULA变量包名:
#安装命令-安装某个包,如python3 wget等
brew install $FORMULA
卸载命令- 卸载某个包
brew uninstall $FORMULA
#查询可用包
brew search $FORMULA
#查询可更新的包
brew outdated
# 更新包
brew update
# 更新指定的包  
brew upgrade $FORMULA
# 清理旧版本  
# 清理所有包的旧版本  
brew cleanup
# 清理指定包的旧版本  
brew cleanup $FORMULA
# 查看可清理的旧版本包,不执行实际操作
brew cleanup -n      

卸载homerew

cd `brew --prefix`
rm -rf Cellar
brew prune
rm `git ls-files`
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions
rm -rf .git
rm -rf ~/Library/Caches/Homebrew
Last modification:December 24, 2020
如果觉得我的文章对你有用,请随意赞赏