Mac M1 brew 安装

2022-8-20    elvin


1.  /bin/zsh -c "$(curl -fsSL https://gitee.com/huwei1024/HomebrewCN/raw/master/Homebrew.sh)"

==> 安装完成,brew版本


12.5

brew -v


zsh:363: command not found: brew

安装完成后,会提示如上错误。原因是:m1的brew安装到了

/opt/homebrew/ 目录下,而不是原来的/usr/local

所以需要修改一下变量配置 

open ~/.zshrc

# HomeBrew

export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles

export PATH="/opt/homebrew/bin:$PATH"

export PATH="/opt/homebrew/sbin:$PATH"

# HomeBrew END


如果后续出现 fatal: not in a git directory 错误

那么运行如下:

git config --global --add safe.directory /opt/homebrew/Homebrew/Library/Taps/homebrew/homebrew-core


git config --global --add safe.directory /opt/homebrew/Homebrew/Library/Taps/homebrew/homebrew-cask