安装homebrew
如果还未安装homebrew的话,使用以下命令安装
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
卸载命令
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"
Step1:更换brew源
查看
cd "$(brew --repo)" && git remote -v
更换
git remote set-url origin https://mirrors.cloud.tencent.com/homebrew/brew.git
Step2:更换homebrew-core源(注意:brew v4 不需要此步)
查看
cd "$(brew --repo homebrew/core)" && git remote -v
更换
git remote set-url origin https://mirrors.cloud.tencent.com/homebrew/homebrew-core.git
Step3:更换homebrew-cask源(注意:brew v4 不需要此步)
查看
cd "$(brew --repo homebrew/cask)" && git remote -v
更换
git remote set-url origin https://mirrors.cloud.tencent.com/homebrew/homebrew-cask.git
Step4:添加环境变量
在.bashrc或.zshrc中设置环境变量
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_PIP_INDEX_URL=https://mirrors.cloud.tencent.com/pypi/simple
export HOMEBREW_API_DOMAIN=https://mirrors.cloud.tencent.com/homebrew-bottles/api
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.cloud.tencent.com/homebrew-bottles
常用命令
#查看已安装的包
brew list
#查看服务列表
brew services list
#启动、停止、重启、热重载服务
brew services start 服务名
brew services stop 服务名
brew services restart 服务名
brew services reload 服务名
#以树形结构显示已安装包的依赖关系
brew deps --installed --tree
文章作者:DOTATONG
发布日期:2022-11-25
评论