diff --git a/Library/Homebrew/hardware.rb b/Library/Homebrew/hardware.rb index 88625b72a3..f03078f877 100644 --- a/Library/Homebrew/hardware.rb +++ b/Library/Homebrew/hardware.rb @@ -11,6 +11,14 @@ module Hardware INTEL_64BIT_ARCHS = [:x86_64].freeze PPC_32BIT_ARCHS = [:ppc, :ppc32, :ppc7400, :ppc7450, :ppc970].freeze PPC_64BIT_ARCHS = [:ppc64, :ppc64le, :ppc970].freeze + ARM_64BIT_ARCHS = [:arm64].freeze + ALL_ARCHS = [ + *INTEL_32BIT_ARCHS, + *INTEL_64BIT_ARCHS, + *PPC_32BIT_ARCHS, + *PPC_64BIT_ARCHS, + *ARM_64BIT_ARCHS, + ].freeze class << self extend T::Sig diff --git a/Library/Homebrew/os/mac/version.rb b/Library/Homebrew/os/mac/version.rb index 6e73ffd6a4..75893a1058 100644 --- a/Library/Homebrew/os/mac/version.rb +++ b/Library/Homebrew/os/mac/version.rb @@ -25,7 +25,11 @@ module OS sig { params(sym: Symbol).returns(T.attached_class) } def self.from_symbol(sym) - str = SYMBOLS.fetch(sym) { raise MacOSVersionError, sym } + @all_archs_regex ||= /^#{Regexp.union(Hardware::CPU::ALL_ARCHS.map(&:to_s))}_/ + sym_without_arch = sym.to_s + .sub(@all_archs_regex, "") + .to_sym + str = SYMBOLS.fetch(sym_without_arch) { raise MacOSVersionError, sym } new(str) end