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

huangapple go评论67阅读模式
英文:

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

问题

背景

我按照这个指南(关于使用Apple Game Porting Toolkit)进行操作,其中提到:

> 即使您的 macOS 上已经安装了 Homebrew,它也可能是为 Apple Silicon 安装的。您需要为 Intel 架构安装它:

arch -x86_64 zsh

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

export PATH="/usr/local/bin:${PATH}"

问题

现在在新的终端中,运行 brew 命令会出现以下消息:

> 错误:无法在 ARM 处理器的 Intel 默认前缀(/usr/local)中安装 Homebrew!
请使用以下之一从“备用安装”中创建新的安装:
https://docs.brew.sh/Installation
您可以使用以下命令迁移先前安装的配方列表:
brew bundle dump

除非我再次运行:

arch -x86_64 zsh

问题

是否有办法让 brew 以其默认形式运行,但不会破坏以下命令:

PATH="/usr/local/bin:${PATH}" arch -x86_64 /usr/local/bin/gameportingtoolkit-no-hud ~/Games/battle-net  ~/Games/battle-net/drive_c/Program\ Files\ \(x86\)/Battle.net/Battle.net\ Launcher.exe
英文:

Background

I followed this guide (on using Apple Game Porting Toolkit), which stated:

> Even if you already have Homebrew installed on your macOS, it is probably installed for Apple Silicon. You need to install it for Intel architecture:

arch -x86_64 zsh

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

export PATH="/usr/local/bin:${PATH}"

Issue

Now in new terminals, brew commands result in the message:

> 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

unless I again run:

arch -x86_64 zsh

Question

Is there a means to get brew going in its default form, but without breaking:

PATH="/usr/local/bin:${PATH}" arch -x86_64 /usr/local/bin/gameportingtoolkit-no-hud ~/Games/battle-net  ~/Games/battle-net/drive_c/Program\ Files\ \(x86\)/Battle.net/Battle.net\ Launcher.exe

?

答案1

得分: 1

这里,我能够编辑(或创建,如果不存在)文件~/.zshrc(通过TextEdit.app或zsh的nano命令):

# ~/.zshrc

export PATH="/usr/local/bin:$PATH"    # arm64e homebrew path (m1   )
export PATH="/opt/homebrew/bin:$PATH" # x86_64 homebrew path (intel)

alias mbrew="arch -arm64e /opt/homebrew/bin/brew" # arm64e homebrew path (m1   )
alias ibrew="arch -x86_64 /usr/local/bin/brew"    # x86_64 homebrew path (intel)

export命令确保可以找到两个brew命令。
我认为M1arm64e)版本会是默认的,因为它在顺序中排在第一位。)

alias命令允许使用M1 brew(使用mbrew)和intel brew(使用ibrew)。

保存zsh配置文件(~/.zshrc)后,运行:

source ~/.zshrc

以将更改应用到终端。

注意:使用alias是我根据这里的规定编写的。

英文:

From here, I was able to edit (or create, if not existing) the file ~/.zshrc (via TextEdit.app or the zsh nano command):

# ~/.zshrc

export PATH="/usr/local/bin:$PATH"    # arm64e homebrew path (m1   )
export PATH="/opt/homebrew/bin:$PATH" # x86_64 homebrew path (intel)

alias mbrew="arch -arm64e /opt/homebrew/bin/brew" # arm64e homebrew path (m1   )
alias ibrew="arch -x86_64 /usr/local/bin/brew"    # x86_64 homebrew path (intel)

The export commands ensure both brew commands can be found.
(I think the M1 (arm64e) version would be the default because it's first in the order.)

The alias commands allow the use of M1 brew (with mbrew) and intel brew (with ibrew).

After saving the zsh configuration file (~/.zshrc), run:

source ~/.zshrc

to enact the changes into the terminal.

Note: Use of alias was written by me, as specified by here.

huangapple
  • 本文由 发表于 2023年6月19日 08:33:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/76503019.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定