在Mac中使用homebrew安装git

在Mac中使用homebrew安装git

首先需要授权用户改变下载的站点,具体如下:

sudo chown $(whoami) ~/.bash_profile #授权用户获得编辑.bash_profile的权限

open -e .bash_profile #打开.bash_profile 文件

添加下述命令:

# brew安装镜像加速
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles
# export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
# export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
# brew4.x API加速
export HOMEBREW_API_DOMAIN="https://mirrors.aliyun.com/homebrew/homebrew-bottles/api"

保存并退出

brew install git #下载并安装git

部分内容参考下文:

解决Mac无法编辑 .bash_profile文件与使用sudo时permission denied报错

macos brew国内镜像加速方法 brew install 加速formula.jws.json下载慢加速

你可能感兴趣的:(git)