我用的是最新的苹果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

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


通过在终端应用程序的Utilities文件夹中启用使用Rosetta选项来临时修复。

然而,它将是伟大的,知道这个问题的实际解决方案使用本机的方式。


无论如何,在安装Homebrew之前,您需要为新的ARM硅(M1芯片)安装Rosetta2模拟器。我刚刚通过终端安装了Rosetta2,使用:

/usr/sbin/softwareupdate——install-rosetta——同意授权

这将安装rosetta2,无需额外单击按钮。

在安装上面的Rosetta2之后,您可以使用Homebrew cmd并安装Homebrew for ARM M1 chip: arch -x86_64 /bin/bash -c "$(curl - ssl https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

一旦安装了Homebrew for M1 ARM,使用以下Homebrew命令安装包


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这样的命令,以帮助将它们分开。


这一问题与新的macbook pro M1芯片

错误:无法在ARM处理器上的Homebrew中安装英特尔默认前缀(/usr/local)!

对于Resolve,请遵循以下步骤

Step1 $ brew包转储 步骤2 $ /bin/bash -c $(curl - ssl . exe https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)” 步骤3 编辑以下文件

$ vi ~/。Bashrc或vi ~/.zshrc 在上面的文件中编辑下面的行

导出路径= / opt /组装/ bin:美元的道路


只使用:

arch -arm64 brew install package-name

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


所以我买了一台新的M1,搬到了那里。我把它拿回来,搬了回来。我收到了这个错误。发现我需要运行sudo rm -Rf /opt/homebrew重新安装brew后,让事情再次流动。M1上的16G内存并没有用英特尔使用的64G内存取代我的工作流程。


首先运行这个命令:

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

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

brew bundle dump

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

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


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


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/。不测试。


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


我已经使用苹果ARM芯片(M1)启用的iTerm安装了Homebrew,但当使用基于英特尔的不同终端程序时(因此在Rosetta中打开),我得到了这个错误。后一个应用程序被视为英特尔,因此想要使用旧的Homebrew路径。


这里的回复中有很多有用的信息,但似乎没有对原始请求的直接回答,“需要帮助,需要遵循确切的步骤。”

为了帮助将来遇到这个问题的人,我将分享我解决这个问题的具体步骤。

下面的CLI命令将在内置的终端应用程序中运行macos默认shell Zsh,运行在苹果硅设备的Mac上:

Run a Homebrew command to confirm that an error like the following appears: $ brew install <formula> 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 Or: $ brew doctor Warning: Your Homebrew's prefix is not /opt/homebrew. Some of Homebrew's bottles (binary packages) can only be used with the default prefix (/opt/homebrew). You will encounter build failures with some formulae. If either of these errors appears, it is likely that the steps below are applicable to your case. Navigate to the /opt folder: $ cd /opt Create a folder named homebrew. By default superuser privileges are required to write inside of the /opt folder, which means that it is necessary to use sudo: $ sudo mkdir homebrew Grant write access to the homebrew folder so that your user can perform the Homebrew installation: $ sudo chmod go+w homebrew Perform the four steps listed on the "Alternative Installs" page (the page mentioned in the first error message in step 1): Install Homebrew: $ curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew Set Homebrew's prefix in your current Terminal session: $ eval "$(homebrew/bin/brew shellenv)" Update Homebrew: $ brew update --force --quiet Revoke write access to specific folders and files: $ chmod -R go-w "$(brew --prefix)/share/zsh" Set Homebrew's prefix in future Terminal sessions by adding the necessary command to one of Zsh's startup files. As far as I can tell, .zshrc is the preferred startup file for this type of command: $ echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrc Note that if there are any other existing Terminal sessions on your machine that have been open since before running the above command, the correct Homebrew prefix will still be unset in those sessions. Confirm that Homebrew's prefix is now properly set: $ type -a brew brew is /opt/homebrew/bin/brew brew is /usr/local/bin/brew Or: $ brew doctor Your system is ready to brew.

现在应该可以继续正常使用Homebrew了。


运行此命令将解决问题

arch -arm64 brew install kotlin