M1芯片安装homebrew,解决brew not found

然仔 2021-11-8 1113

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


最新回复 (1)
  • zhuanbike 2021-11-8
    0 2
    卸载命令 
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
发新帖