前言
最近换了M1 pro的新版mbp,在启动本地redis跑项目时,提示以下内容,告诉我brew不能用了
Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
Please create a new installation in /opt/homebrew using one of the
"Alternative Installs" from:
https://docs.brew.sh/Installation
You can migrate your previously installed formula list with:
brew bundle dump
意思就是说arm架构和Intel架构的不同,brew目录需要放在/opt/homebrew 下,而不是/usr/local下了。
解决方法
- 去/opt下创建homebrew文件夹,需要使用管理员权限
cd /opt
sudo mkdir homebrew
- 通过github克隆新的brew文件包
git clone https://github.com/Homebrew/brew homebrew
- 更新brew并赋予权限
eval "$(homebrew/bin/brew shellenv)"
brew update --force --quiet
chmod -R go-w "$(brew --prefix)/share/zsh"