#6870·goreleaser

homebrew_casks: hooks emit Homebrew's deprecated `postflight` stanza

Author: jonhadfieldCreated Sep 5, 2026Updated Sep 5, 2026

Summary

homebrew_casks with hooks.post.install generates a postflight do ... end block. Homebrew now deprecates that stanza, so every brew command touching the cask prints:

Warning: Calling `postflight` is deprecated! Use `postflight_steps` instead.
Please report this issue to the <owner>/homebrew-<tap> tap (not Homebrew/* repositories), or even better, submit a PR to fix it:
  /opt/homebrew/Library/Taps/<owner>/homebrew-<tap>/Casks/<cask>.rb:36

The cask is generated and carries # This file was generated by GoReleaser. DO NOT EDIT., so a tap maintainer cannot fix it in the tap — the next release overwrites it — and there is no config option to change what is emitted.

Config that produces it

yaml
homebrew_casks:
  - name: ipscout
    repository:
      owner: jonhadfield
      name: homebrew-ipscout
    # the binaries are unsigned, so clear the quarantine attribute on
    # install to avoid Gatekeeper blocking them
    hooks:
      post:
        install: |
          if system_command("/usr/bin/xattr", args: ["-h"]).exit_status == 0
            system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/ipscout"]
          end

Generated cask (GoReleaser v2.18.0, Homebrew 6.0.21):

ruby
  postflight do
    if system_command("/usr/bin/xattr", args: ["-h"]).exit_status == 0
      system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/ipscout"]
    end
  end

Why it matters beyond the warning

Clearing com.apple.quarantine is the common use of this hook for projects shipping unsigned binaries, because Gatekeeper kills a quarantined ad-hoc-signed binary — it exits 137 and prints nothing. If postflight is removed rather than deprecated, that hook silently stops running: releases keep succeeding, the cask keeps installing, and users get a binary that dies with no output. The failure surfaces at install time on other people's machines, not at release time.

The replacement is not a rename

postflight_steps takes a declarative, normalised list of typed steps and runs them in a sandbox (Library/Homebrew/install_steps.rb, Library/Homebrew/cask/artifact/install_steps.rb), rather than a block of arbitrary Ruby. So emitting the new stanza needs the hook body mapped onto the step model, or a new field that accepts steps directly — for example a run step invoking /usr/bin/xattr.

Versions

  • GoReleaser v2.18.0 (latest at time of writing)
  • Homebrew 6.0.21
  • macOS 26.5