我用的是最新的苹果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需要安装在苹果芯片上的两个地方:用于rosetta- emululated (Intel)代码的/usr/local,用于ARM64的/opt/ Homebrew。这些在某种程度上是硬编码的,而/opt/homebrew必须用于ARM代码,就像今天一样,这是不可协商的。不过,它的安装非常简单,你可以按照官方文档上的一般说明进行安装。你先打开罗塞塔外壳。
% arch -x86_64 zsh
% cd /usr/local && mkdir homebrew
% curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
稍后,要在intel下安装工具,您可以逐个命令使用arch命令或像上面那样打开zsh终端。
arch -x86_64 /usr/local/homebrew/bin/brew install sometool
对于ARM架构,你不需要使用arch,但是你需要使用homebrew命令的完整路径。
/opt/homebrew/bin/brew install sometool
您可以将酿造命令重命名为像brew86和brewARM这样的命令,以帮助将它们分开。
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/。不测试。