我用的是最新的苹果M1芯片处理器。在安装应用程序时,我总是出错。

说,

brew install openjdk@11
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

需要帮助,知道具体的步骤。


当前回答

Homebrew现在可以在https://docs.brew.sh/Installation上购买新的苹果M1芯片。脚本安装在一个新的位置,' /opt/homebrew '而不是' /usr/local ',这需要你在安装后实现几行脚本,替换你的用户名。您可以从安装中的注释中复制/粘贴。不要跳过这些步骤。

==> Next steps:
- Add Homebrew to your PATH in /Users/[username]/.zprofile:
    echo 'eval "$(/opt/homebrew/bin/brew [username])"' >> /Users/[username]/.zprofile
    eval "$(/opt/homebrew/bin/brew [username])"

注意:这适用于在新机器上干净地安装Homebrew。如果你已经安装了一个旧版本的Homebrew并让它工作,我相信你需要先卸载它-或者-你可能会发现这是一个更快的解决方案http://blog.wafrat.com/homebrew-on-mac-with-m1/。不测试。

其他回答

首先运行这个命令:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

然后它会问你一个问题,点击返回,然后等待安装完成。之后执行以下命令:

brew bundle dump

在终端上运行这个程序就能解决问题

eval “$(/opt/homebrew/bin/brew shellenv)”

如果您试图在IntelliJ终端中运行您的命令,也可能会发生这种情况。试着在(常规)终端运行。

转到https://brew.sh并使用该命令。它将再次正确地下载和安装brew。

只使用:

arch -arm64 brew install package-name

用你想安装的包替换'package-name'。