M1芯片需要单独设置默认命令的目录,一共两个命令
/bin/zsh -c "$(curl -fsSL https://gitee.com/huwei1024/HomebrewCN/raw/master/Homebrew.sh)"
PATH=/opt/homebrew/bin:$PATH
彻底写入配置文件:
1、终端下输入:
sudo vim .zprofile
2、随后输入用户密码进入文本,点击i进入编辑模式(做左下角会有INSERT),添加:
export PATH=/opt/homebrew/bin:$PATH
3、而后esc退出编辑模式,输入:wq退出并保存文本,终端下输入:
source .zprofile
替换国内数据源:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
brew update