Bottle compatibility precedence across overlapping macOS version ranges
0 reputation · 20 Feb 2021, 09:15 UTC
0 reputation · 20 Feb 2021, 09:15 UTC
When a formula provides multiple pre-compiled bottle candidates with overlapping but non-identical macOS version compatibility, Homebrew's mechanism for selecting a single optimal bottle is not explicitly documented. The stated resolution logic references the current macOS version and architecture, but does not address how minor version differentials, build‑version suffixes, or arm64/x86_64 hybrid targets influence candidate prioritization.
This ambiguity arises when a user's system version falls between declared bottle compatibility ranges, creating uncertainty about whether Homebrew will select the newest compatible archive, the most restrictive version match, or fall back to compilation from source.
1. Newest compatible bottle? No. Homebrew selects the bottle whose tag exactly matches the normalized current macOS version symbol (e.g., sonoma, ventura). It does not sort by recency or SDK version.
2. Sort order? No SDK-version, architecture-specificity, or checksum sorting occurs during candidate selection. Architecture is resolved before version lookup (only the arm64_*, x86_64_*, or all namespace matching Hardware::CPU.arch is consulted), then a direct key match against the normalized version symbol is performed.
3. Fallback trigger? Source compilation happens only when no bottle entry exists for the current architecture and the normalized macOS version symbol. Overlapping ranges do not cause fallback because the lookup is a hash-key match, not a range intersection.
MacOS.version (e.g., 14.5) is mapped to a symbolic name via MacOSVersion.to_sym (14.x → :sonoma, 13.x → :ventura, 15.x → :sequoia).bottle block is split into arm64_*, x86_64_*, and all keys. Only the namespace matching Hardware::CPU.arch (or Rosetta via arch -x86_64 brew / HOMEBREW_FORCE_ARCH=x86_64) is considered.arm64_sonoma). If present, that bottle is used. If absent, no other key in that namespace is tried — the formula falls back to building from source.A formula may declare both arm64_ventura and arm64_sonoma. On a Sonoma Mac, only arm64_sonoma is checked; the Ventura bottle is ignored entirely. There is no “closest match” logic. Maintainers control precedence only by ordering keys in the DSL block (earlier duplicate symbols win), but duplicates are rare and discouraged.
# 1. See which tags the formula publishes
brew info --json=v2 | jq '.formulae[0].bottle.tags | keys[]'
# 2. See your normalized version symbol
brew --macos-version # e.g., 14.5
# Homebrew internally maps 14.x → sonoma
# 3. Watch the exact tag selected (debug log)
HOMEBREW_DEBUG=1 brew install 2>&1 | grep -i pouring
# Output: Pouring --..bottle.tar.gz
# 4. Force fallback to confirm source path
mv ~/Library/Caches/Homebrew/downloads/--..bottle.tar.gz{,.bak}
brew install # should compile from source
BottleSpecification class may change in future major releases.14.4) instead of symbolic names; Homebrew still performs exact string match after its own normalization.x86_64 bottles are only consulted when explicitly invoked via arch -x86_64 brew or HOMEBREW_FORCE_ARCH=x86_64.HOMEBREW_BOTTLE_DOMAIN mirrors or --bottle-tag overrides affect which file is fetched, not the candidate-selection algorithm.If you are seeing a bottle not matching your normalized version symbol being poured, run HOMEBREW_DEBUG=1 brew install and share the Pouring line. That would indicate either a tap using non-standard tags or a version-normalization bug worth reporting upstream.
Use comments to ask for clarification. Post a solution as an answer.
6,640 reputation · 20 Feb 2021, 09:47 UTC
The practical way to resolve this is to inspect the formula's bottle do block with brew cat <formula> and compare it against your brew config output. Homebrew matches the macOS release symbol (for example :ventura, :sonoma) and the architecture of your active prefix—arm64 under /opt/homebrew or x86_64 under /usr/local.
A key distinction: bottles tagged :any_skip_relocation are treated as compatible across macOS versions for that architecture, while bottles without that tag are generally tied to the release they were built on. Rebuild suffixes distinguish repeated builds of the same formula version but do not influence macOS-version precedence.
Because the exact fallback ordering across overlapping non-identical ranges is not part of Homebrew's public documentation and can change between releases, verify locally with brew install --build-from-source --verbose <formula> to observe whether Homebrew reports no bottle available or downloads a specific bottle tag.