Merge pull request #10319 from dcow/master

install: add workaround for rosetta2 path error to msg
This commit is contained in:
Mike McQuaid 2021-01-26 11:18:29 +00:00 committed by GitHub
commit 8a06a5ea4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,12 +32,16 @@ module Homebrew
def check_prefix def check_prefix
if (Hardware::CPU.intel? || Hardware::CPU.in_rosetta2?) && if (Hardware::CPU.intel? || Hardware::CPU.in_rosetta2?) &&
HOMEBREW_PREFIX.to_s == HOMEBREW_MACOS_ARM_DEFAULT_PREFIX HOMEBREW_PREFIX.to_s == HOMEBREW_MACOS_ARM_DEFAULT_PREFIX
configuration = if Hardware::CPU.in_rosetta2? if Hardware::CPU.in_rosetta2?
"under Rosetta 2" odie <<~EOS
Cannot install under Rosetta 2 in ARM default prefix (#{HOMEBREW_PREFIX})!
To rerun under ARM use:
arch -arm64 brew install ...
To install under x86_64, install Homebrew into #{HOMEBREW_DEFAULT_PREFIX}.
EOS
else else
"on Intel processor" odie "Cannot install on Intel processor in ARM default prefix (#{HOMEBREW_PREFIX})!"
end end
odie "Cannot install in Homebrew #{configuration} in ARM default prefix (#{HOMEBREW_PREFIX})!"
elsif Hardware::CPU.arm? && HOMEBREW_PREFIX.to_s == HOMEBREW_DEFAULT_PREFIX elsif Hardware::CPU.arm? && HOMEBREW_PREFIX.to_s == HOMEBREW_DEFAULT_PREFIX
odie <<~EOS odie <<~EOS
Cannot install in Homebrew on ARM processor in Intel default prefix (#{HOMEBREW_PREFIX})! Cannot install in Homebrew on ARM processor in Intel default prefix (#{HOMEBREW_PREFIX})!