Skip to content

[Bug]: brew update 一直提示 depends_on macos 废弃警告(tap 的 cask 需要改一行) #101

Description

@FrancoLan

问题描述 / Description

tap 过 chenbstack/glint 的用户,每次 brew update 都会看到:

Warning: Calling string comparison format for `depends_on macos:` is deprecated! Use `depends_on macos: :sonoma` instead.
Please report this issue to the chenbstack/homebrew-glint tap (not Homebrew/* repositories), or even better, submit a PR to fix it:
  /opt/homebrew/Library/Taps/chenbstack/homebrew-glint/Casks/glint.rb:21

原因是 Homebrew 已经废弃了 depends_on macos: 的字符串比较写法。裸符号本身就表示「该版本或更高」,所以改成 depends_on macos: :sonoma 可以保持现在 Sonoma+ 的最低版本要求,同时去掉警告。目前只是 warning,不影响安装和使用,但 Homebrew 后续会把它变成硬错误。

如何复现 / Steps to reproduce

  1. brew tap chenbstack/glint
  2. brew update
  3. 输出里出现上面的警告

环境 / Environment

  • tap cask: glint 0.1.27
  • Homebrew 6.0.16
  • macOS 27.0 (Apple Silicon)

修复 / Fix

Casks/glint.rb:21 一行改动,PR 已经提在 tap 仓库:chenbstack/homebrew-glint#1

-  depends_on macos: ">= :sonoma"
+  depends_on macos: :sonoma

brew style Casks/glint.rb 验证过:

  • 改之前:Casks/glint.rb:21:21: C: [Correctable] Homebrew/OSDependsOn: Use depends_on macos: :sonoma.
  • 改之后:这条 offence 消失

另外确认了 release.yml 里 bump tap 那步只 sed 替换 versionsha256 两行,所以这个改动不会被后续发版覆盖。

在主仓库同步一下,方便你注意到。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions