安装
开源安装脚本库:https://gitee.com/cunkai/HomebrewCN
复制以下内容到你的终端:
intel芯片:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
M1芯片:
/bin/zsh -c "$(curl -fsSL https://gitee.com/huwei1024/HomebrewCN/raw/master/Homebrew.sh)"
回车运行
因为M1芯片的包安装位置不在是以前的/usr/local/
而是/opt/homebrew,所以要将配置文件里的环境变量改过来
1、首先进入根目录
$ cd ~
2、创建.zshrc文件
$ touch .zshrc
3、打开文件进行编辑
$ open -e .zshrc
4、如果有旧的环境就修改,没有就新增
export PATH="/opt/homebrew/bin:$PATH"
export PATH="/opt/homebrew/sbin:$PATH"
5、保存
使用command + s
6、生效环境变量
$ source .zshrc
7、测试
$ brew -v