Skip to content

fix(cask): use bare symbol for depends_on macos to silence Homebrew 6 deprecation - #16

Open
UreMySunshine wants to merge 1 commit into
HduSy:mainfrom
UreMySunshine:fix/cask-depends-on-macos-symbol
Open

fix(cask): use bare symbol for depends_on macos to silence Homebrew 6 deprecation#16
UreMySunshine wants to merge 1 commit into
HduSy:mainfrom
UreMySunshine:fix/cask-depends-on-macos-symbol

Conversation

@UreMySunshine

Copy link
Copy Markdown
Contributor

问题

安装或更新后,Homebrew 每次都输出废弃警告:

Warning: Calling string comparison format for `depends_on macos:` is deprecated!
Use `depends_on macos: :catalina` instead.
  /opt/homebrew/Library/Taps/hdusy/homebrew-tokenscope/Casks/tokenscope.rb:10

来源是 .github/workflows/release.yml 生成 cask 时写的 depends_on macos: ">= :catalina"。Homebrew 6 在 MacOSRequirement.parse 中对字符串比较格式调用 odeprecated,后续版本会从废弃变为禁用。

为什么现在可以用裸符号

498bb3a 当初改用字符串形式,是因为裸符号曾被解析为 ==(只允许 Catalina),会拦下 macOS 26 的安装。

Homebrew 5.1.11 起(提交 0e87cc8941 Align cask macOS dependencies),cask DSL 以 MacOSRequirement.parse(args, comparator: ">=") 解析该字段,裸符号即表示最低版本。

在 Homebrew 6.0.20 / macOS 26 上实测:

comparator=">=" version=#<MacOSVersion: "10.15">
satisfied_on_this_mac=true

语义与 ">= :catalina" 一致,同时与 app 的 LSMinimumSystemVersion 10.15 保持一致。

影响范围

改动只影响下次发版生成的 cask。tap 仓库 HduSy/homebrew-tokenscope 中现有的 Casks/tokenscope.rb(v1.0.5)仍是旧写法,警告会持续到下次发版,或需在 tap 仓库单独改一次。

使用 Homebrew 早于 5.1.11 版本的用户,裸符号仍会被解析为 == 而拦下安装。考虑到 Homebrew 6 已发布且字符串形式即将禁用,此处采用裸符号。

🤖 Generated with Claude Code

Homebrew 6 deprecates the string comparison format, warning on every
`brew install`/`brew update`:

  Warning: Calling string comparison format for `depends_on macos:` is
  deprecated! Use `depends_on macos: :catalina` instead.

Since Homebrew 5.1.11 (commit "Align cask macOS dependencies"), the cask
DSL parses `depends_on macos:` with a ">=" comparator, so a bare symbol
means "Catalina or newer" rather than "Catalina only". Verified on
Homebrew 6.0.20 / macOS 26: comparator=">=", version=10.15, satisfied.

This reverts the workaround in 498bb3a, which was needed only under the
older "==" semantics.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

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.

1 participant