Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install: add workaround for rosetta2 path error to msg #10319

Merged
merged 4 commits into from Jan 26, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 13 additions & 4 deletions Library/Homebrew/install.rb
Expand Up @@ -32,12 +32,21 @@ def perform_build_from_source_checks(all_fatal: false)
def check_prefix
if (Hardware::CPU.intel? || Hardware::CPU.in_rosetta2?) &&
HOMEBREW_PREFIX.to_s == HOMEBREW_MACOS_ARM_DEFAULT_PREFIX
configuration = if Hardware::CPU.in_rosetta2?
"under Rosetta 2"
if Hardware::CPU.in_rosetta2?
odie <<~EOS
This invocation of Homebrew is being translated by Rosetta2 however it is
installed in the ARM default prefix (#{HOMEBREW_PREFIX})! Are you are using an
x86_64 build of your terminal emulator? All invocations of this Homebrew
installation must be native arm64.
Use:
arch -arm64 brew install ...

to invoke Homebrew natively. Alternatively, if indeed you want x86_64 packages,
setup a separate x86_64 Homebrew installation and invoke that one.
dcow marked this conversation as resolved.
Show resolved Hide resolved
EOS
else
"on Intel processor"
odie "Cannot install on Intel processor in ARM default prefix (#{HOMEBREW_PREFIX})!"
end
odie "Cannot install in Homebrew #{configuration} in ARM default prefix (#{HOMEBREW_PREFIX})!"
elsif Hardware::CPU.arm? && HOMEBREW_PREFIX.to_s == HOMEBREW_DEFAULT_PREFIX
odie <<~EOS
Cannot install in Homebrew on ARM processor in Intel default prefix (#{HOMEBREW_PREFIX})!
Expand Down