Skip to content

Conversation

@taronsung
Copy link

Summary

When a cask uses the requires_rosetta built-in caveat, mark on_system_blocks_exist on the DSL so that architecture variations are properly computed during API JSON generation.

Problem

Intel Mac users see the Rosetta 2 caveat when installing casks via the API, even though Rosetta 2 is only needed on Apple Silicon Macs. This happens because:

  1. The API JSON is generated while simulating ARM architecture
  2. The requires_rosetta caveat includes the Rosetta warning in the base JSON
  3. Variations for Intel architecture are NOT computed because on_system_blocks_exist? is false (the requires_rosetta caveat didn't set it)
  4. When an Intel user installs the cask, they get the pre-computed ARM caveats without the Intel variation override

Solution

Call @cask.mark_on_system_blocks_exist! in the requires_rosetta caveat to ensure architecture variations are computed. This means:

  • ARM: Rosetta caveat is included (correct)
  • Intel variation: Rosetta caveat is nil (correct - will override the base)

When the cask is loaded on an Intel machine via the API, merge_variations will apply the Intel variation which has no Rosetta caveat.

Test

All changed-file tests pass with brew tests --changed.

Fixes #18365

When a cask uses the requires_rosetta built-in caveat, mark on_system_blocks_exist
on the DSL so that architecture variations are properly computed during API
JSON generation. This ensures Intel machines don't see the Rosetta 2 caveat
when installing casks via the API.

Fixes Homebrew#18365
@MikeMcQuaid
Copy link
Member

@taronsung did you use AI to perform any part of this PR? If so, which one, for what parts and what was your prompt(s)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid outputting Rosetta 2 caveats on Intel machines

2 participants