diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb
index d7419e2ae8bcf4ae5473ceec0dc2c74209bfacfc..e950ac2e6a4e5859ff037548bdd289ba58f431ac 100644
--- a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb
+++ b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb
@@ -7,7 +7,7 @@ module Stdenv
   undef homebrew_extra_pkg_config_paths, x11
 
   def homebrew_extra_pkg_config_paths
-    ["#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}"]
+    ["#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.sdk_version}"]
   end
 
   def x11
diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb
index d797ff7484bed9040032b87280fcb57dd1010c31..118003d17ffa613c13ca92a0dca1ca76abd925d0 100644
--- a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb
@@ -34,7 +34,7 @@ module Superenv
   # @private
   def homebrew_extra_pkg_config_paths
     paths = \
-      ["/usr/lib/pkgconfig", "#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}"]
+      ["/usr/lib/pkgconfig", "#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.sdk_version}"]
     paths << "#{MacOS::XQuartz.lib}/pkgconfig" << "#{MacOS::XQuartz.share}/pkgconfig" if x11?
     paths
   end
diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb
index 2be9dfc439c61339ef5737ef3a24ec6bf71b0e7f..26f373068d9d4dde434864aecf55adef09d46339 100644
--- a/Library/Homebrew/os/mac.rb
+++ b/Library/Homebrew/os/mac.rb
@@ -25,7 +25,7 @@ module OS
     # This can be compared to numerics, strings, or symbols
     # using the standard Ruby Comparable methods.
     def version
-      @version ||= Version.new(full_version.to_s[/^\d+\.\d+/])
+      @version ||= Version.from_symbol(full_version.to_sym)
     end
 
     # This can be compared to numerics, strings, or symbols
@@ -39,9 +39,16 @@ module OS
       @version = nil
     end
 
+    sig { returns(::Version) }
     def latest_sdk_version
       # TODO: bump version when new Xcode macOS SDK is released
-      Version.new "11.0"
+      ::Version.new("11.0")
+    end
+    private :latest_sdk_version
+
+    sig { returns(::Version) }
+    def sdk_version
+      full_version.major_minor
     end
 
     def outdated_release?
@@ -55,7 +62,7 @@ module OS
       # TODO: bump version when new macOS is released or announced
       # and also update references in docs/Installation.md and
       # https://github.com/Homebrew/install/blob/HEAD/install.sh
-      version >= "12.0"
+      version >= "12"
     end
 
     def languages
diff --git a/Library/Homebrew/os/mac/version.rb b/Library/Homebrew/os/mac/version.rb
index bdda425aa670c764854b3f783c4f4ea4c39c40bb..6e73ffd6a4580ee0fcded38b952ec39be636ac02 100644
--- a/Library/Homebrew/os/mac/version.rb
+++ b/Library/Homebrew/os/mac/version.rb
@@ -1,6 +1,7 @@
 # typed: true
 # frozen_string_literal: true
 
+require "exceptions"
 require "hardware"
 require "version"
 
@@ -10,8 +11,10 @@ module OS
     #
     # @api private
     class Version < ::Version
+      extend T::Sig
+
       SYMBOLS = {
-        big_sur:     "11.0",
+        big_sur:     "11",
         catalina:    "10.15",
         mojave:      "10.14",
         high_sierra: "10.13",
@@ -20,35 +23,52 @@ module OS
         yosemite:    "10.10",
       }.freeze
 
+      sig { params(sym: Symbol).returns(T.attached_class) }
       def self.from_symbol(sym)
         str = SYMBOLS.fetch(sym) { raise MacOSVersionError, sym }
         new(str)
       end
 
+      sig { params(value: T.nilable(String)).void }
       def initialize(value)
-        super(value)
+        raise MacOSVersionError, value unless /\A1\d+(?:\.\d+){0,2}\Z/.match?(value)
 
-        raise MacOSVersionError, value unless value.match?(/\A1\d+(?:\.\d+){0,2}\Z/)
+        super(value)
 
         @comparison_cache = {}
       end
 
       def <=>(other)
         @comparison_cache.fetch(other) do
-          v = SYMBOLS.fetch(other) { other.to_s }
-          @comparison_cache[other] = super(::Version.new(v))
+          if SYMBOLS.key?(other) && to_sym == other
+            0
+          else
+            v = SYMBOLS.fetch(other) { other.to_s }
+            @comparison_cache[other] = super(::Version.new(v))
+          end
         end
       end
 
+      sig { returns(Symbol) }
       def to_sym
-        SYMBOLS.invert.fetch(@version, :dunno)
+        @to_sym ||= begin
+          # Big Sur is 11.x but Catalina is 10.15.
+          major_macos = if major >= 11
+            major
+          else
+            major_minor
+          end.to_s
+          SYMBOLS.invert.fetch(major_macos, :dunno)
+        end
       end
 
+      sig { returns(String) }
       def pretty_name
-        to_sym.to_s.split("_").map(&:capitalize).join(" ")
+        @pretty_name ||= to_sym.to_s.split("_").map(&:capitalize).join(" ").freeze
       end
 
       # For {OS::Mac::Version} compatibility.
+      sig { returns(T::Boolean) }
       def requires_nehalem_cpu?
         unless Hardware::CPU.intel?
           raise "Unexpected architecture: #{Hardware::CPU.arch}. This only works with Intel architecture."
diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb
index daf3706fb477abf03f868537952dbd8c802533bd..e5c33b7b96ebb0a3f7c42c0edcfe48d8109f0053 100644
--- a/Library/Homebrew/os/mac/xcode.rb
+++ b/Library/Homebrew/os/mac/xcode.rb
@@ -22,7 +22,7 @@ module OS
       def latest_version
         latest_stable = "12.2"
         case MacOS.version
-        when /^11\./ then latest_stable
+        when "11" then latest_stable
         when "10.15" then "12.2"
         when "10.14" then "11.3.1"
         when "10.13" then "10.1"
@@ -45,7 +45,7 @@ module OS
       sig { returns(String) }
       def minimum_version
         case MacOS.version
-        when /^11\./ then "12.2"
+        when "11" then "12.2"
         when "10.15" then "11.0"
         when "10.14" then "10.2"
         when "10.13" then "9.0"
@@ -54,28 +54,33 @@ module OS
         end
       end
 
+      sig { returns(T::Boolean) }
       def below_minimum_version?
         return false unless installed?
 
         version < minimum_version
       end
 
+      sig { returns(T::Boolean) }
       def latest_sdk_version?
-        OS::Mac.version >= OS::Mac.latest_sdk_version
+        OS::Mac.full_version >= OS::Mac.latest_sdk_version
       end
 
+      sig { returns(T::Boolean) }
       def needs_clt_installed?
         return false if latest_sdk_version?
 
         without_clt?
       end
 
+      sig { returns(T::Boolean) }
       def outdated?
         return false unless installed?
 
         version < latest_version
       end
 
+      sig { returns(T::Boolean) }
       def without_clt?
         !MacOS::CLT.installed?
       end
@@ -275,7 +280,7 @@ module OS
       sig { returns(String) }
       def latest_clang_version
         case MacOS.version
-        when /^11\./, "10.15" then "1200.0.32.27"
+        when "11", "10.15" then "1200.0.32.27"
         when "10.14" then "1100.0.33.17"
         when "10.13" then "1000.10.44.2"
         when "10.12" then "900.0.39.2"
@@ -291,7 +296,7 @@ module OS
       sig { returns(String) }
       def minimum_version
         case MacOS.version
-        when /^11\./ then "12.0.0"
+        when "11" then "12.0.0"
         when "10.15" then "11.0.0"
         when "10.14" then "10.0.0"
         when "10.13" then "9.0.0"
diff --git a/Library/Homebrew/tap_constants.rb b/Library/Homebrew/tap_constants.rb
index aa187c838ba795cade6b18d4804918a13e7e2efd..b9edb7afebc4306dc362b76ce5e842b0f9ca023a 100644
--- a/Library/Homebrew/tap_constants.rb
+++ b/Library/Homebrew/tap_constants.rb
@@ -6,7 +6,7 @@ HOMEBREW_TAP_FORMULA_REGEX = %r{^([\w-]+)/([\w-]+)/([\w+-.@]+)$}.freeze
 # Match taps' casks, e.g. `someuser/sometap/somecask`
 HOMEBREW_TAP_CASK_REGEX = %r{^([\w-]+)/([\w-]+)/([a-z0-9\-]+)$}.freeze
 # Match taps' directory paths, e.g. `HOMEBREW_LIBRARY/Taps/someuser/sometap`
-HOMEBREW_TAP_DIR_REGEX = %r{#{Regexp.escape(HOMEBREW_LIBRARY)}/Taps/(?<user>[\w-]+)/(?<repo>[\w-]+)}.freeze
+HOMEBREW_TAP_DIR_REGEX = %r{#{Regexp.escape(HOMEBREW_LIBRARY.to_s)}/Taps/(?<user>[\w-]+)/(?<repo>[\w-]+)}.freeze
 # Match taps' formula paths, e.g. `HOMEBREW_LIBRARY/Taps/someuser/sometap/someformula`
 HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{(?:/.*)?$}.source).freeze
 # Match official taps' casks, e.g. `homebrew/cask/somecask or homebrew/cask-versions/somecask`
diff --git a/Library/Homebrew/test/os/mac/diagnostic_spec.rb b/Library/Homebrew/test/os/mac/diagnostic_spec.rb
index 3528775e546f1624be0d8e28cc068487d457251a..ad6f14632e0ad9f886760bf3fe9b62477988aa76 100644
--- a/Library/Homebrew/test/os/mac/diagnostic_spec.rb
+++ b/Library/Homebrew/test/os/mac/diagnostic_spec.rb
@@ -6,7 +6,10 @@ require "diagnostic"
 describe Homebrew::Diagnostic::Checks do
   specify "#check_for_unsupported_macos" do
     ENV.delete("HOMEBREW_DEVELOPER")
-    allow(OS::Mac).to receive(:version).and_return(OS::Mac::Version.new("10.14"))
+
+    macos_version = OS::Mac::Version.new("10.14")
+    allow(OS::Mac).to receive(:version).and_return(macos_version)
+    allow(OS::Mac).to receive(:full_version).and_return(macos_version)
     allow(OS::Mac).to receive(:prerelease?).and_return(true)
 
     expect(subject.check_for_unsupported_macos)
@@ -14,17 +17,21 @@ describe Homebrew::Diagnostic::Checks do
   end
 
   specify "#check_if_xcode_needs_clt_installed" do
-    allow(MacOS).to receive(:version).and_return(OS::Mac::Version.new("10.11"))
-    allow(MacOS::Xcode).to receive(:installed?).and_return(true)
-    allow(MacOS::Xcode).to receive(:version).and_return("8.0")
-    allow(MacOS::Xcode).to receive(:without_clt?).and_return(true)
+    macos_version = OS::Mac::Version.new("10.11")
+    allow(OS::Mac).to receive(:version).and_return(macos_version)
+    allow(OS::Mac).to receive(:full_version).and_return(macos_version)
+    allow(OS::Mac::Xcode).to receive(:installed?).and_return(true)
+    allow(OS::Mac::Xcode).to receive(:version).and_return("8.0")
+    allow(OS::Mac::Xcode).to receive(:without_clt?).and_return(true)
 
     expect(subject.check_if_xcode_needs_clt_installed)
       .to match("Xcode alone is not sufficient on El Capitan")
   end
 
   specify "#check_ruby_version" do
-    allow(MacOS).to receive(:version).and_return(OS::Mac::Version.new("10.12"))
+    macos_version = OS::Mac::Version.new("10.12")
+    allow(OS::Mac).to receive(:version).and_return(macos_version)
+    allow(OS::Mac).to receive(:full_version).and_return(macos_version)
     stub_const("RUBY_VERSION", "1.8.6")
 
     expect(subject.check_ruby_version)
diff --git a/Library/Homebrew/test/os/mac/pkgconfig_spec.rb b/Library/Homebrew/test/os/mac/pkgconfig_spec.rb
index 4b0e2abbba076286a5e199d4532eb7d043f5a74b..a0158d318a9163c6c3a0b05a38f243a0c1d731c1 100644
--- a/Library/Homebrew/test/os/mac/pkgconfig_spec.rb
+++ b/Library/Homebrew/test/os/mac/pkgconfig_spec.rb
@@ -15,7 +15,7 @@
 # For indeterminable cases, consult https://opensource.apple.com for the version used.
 describe "pkg-config" do
   def pc_version(library)
-    path = HOMEBREW_LIBRARY_PATH/"os/mac/pkgconfig/#{MacOS.version}/#{library}.pc"
+    path = HOMEBREW_LIBRARY_PATH/"os/mac/pkgconfig/#{MacOS.sdk_version}/#{library}.pc"
     version = File.foreach(path)
                   .lazy
                   .grep(/^Version:\s*?(.+)$/) { Regexp.last_match(1) }
diff --git a/Library/Homebrew/test/os/mac/version_spec.rb b/Library/Homebrew/test/os/mac/version_spec.rb
index efd09385716badc4dc8c8932a570a1bb25ce1af1..9b3f3ed15e1904fa046d557901207daf4e880889 100644
--- a/Library/Homebrew/test/os/mac/version_spec.rb
+++ b/Library/Homebrew/test/os/mac/version_spec.rb
@@ -5,7 +5,9 @@ require "version"
 require "os/mac/version"
 
 describe OS::Mac::Version do
-  subject(:version) { described_class.new("10.14") }
+  let(:version) { described_class.new("10.14") }
+  let(:big_sur_major) { described_class.new("11.0") }
+  let(:big_sur_update) { described_class.new("11.1") }
 
   specify "comparison with Symbol" do
     expect(version).to be > :high_sierra
@@ -38,6 +40,22 @@ describe OS::Mac::Version do
     expect(version).to be < Version.create("10.15")
   end
 
+  context "after Big Sur" do
+    specify "comparison with :big_sur" do
+      expect(big_sur_major).to eq :big_sur
+      expect(big_sur_major).to be <= :big_sur
+      expect(big_sur_major).to be >= :big_sur
+      expect(big_sur_major).not_to be > :big_sur
+      expect(big_sur_major).not_to be < :big_sur
+
+      expect(big_sur_update).to eq :big_sur
+      expect(big_sur_update).to be <= :big_sur
+      expect(big_sur_update).to be >= :big_sur
+      expect(big_sur_update).not_to be > :big_sur
+      expect(big_sur_update).not_to be < :big_sur
+    end
+  end
+
   describe "#new" do
     it "raises an error if the version is not a valid macOS version" do
       expect {
diff --git a/Library/Homebrew/utils/analytics.rb b/Library/Homebrew/utils/analytics.rb
index 5ae0e106f5bb9a35ac505b2e191b5c2adfea0002..89dda53098a871326ba57b0288ad70a2c745bc83 100644
--- a/Library/Homebrew/utils/analytics.rb
+++ b/Library/Homebrew/utils/analytics.rb
@@ -1,6 +1,7 @@
 # typed: false
 # frozen_string_literal: true
 
+require "context"
 require "erb"
 
 module Utils