0%

Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)

遇到的问题

1
2
3
4
5
6
7
8
9
10
11
Warning: your HOMEBREW_PREFIX is set to /usr/local but HOMEBREW_CELLAR is set
to /opt/homebrew/Cellar. Your current HOMEBREW_CELLAR location will stop
you being able to use all the binary packages (bottles) Homebrew provides. We
recommend you move your HOMEBREW_CELLAR to /usr/local/Cellar which will get you
access to all bottles."
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

无法安装软件了
那为何之前又能安装MySQL、Redis呢?

1
2
3
Error: Failed to link all completions, docs and manpages:
Permission denied @ dir_s_mkdir - /usr/local/etc
Failed during: /opt/homebrew/bin/brew update --force --quiet

卸载

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

重新安装

1
2
3
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# 此时是安装到了/usr/local下,把它们移动到/opt/homebrew
sudo mv /usr/local/* /opt/homebrew/

brew install nginx安装,发现可以了

反思

嗯,遇到阻塞,冷静,查清楚问题本质
脑子不清晰的时候不要钻牛角尖

参考

https://stackoverflow.com/questions/64963370/error-cannot-install-in-homebrew-on-arm-processor-in-intel-default-prefix-usr