Skip to content

Fix cog cask postflight xattr referencing wrong filename#32

Merged
markphelps merged 1 commit intomainfrom
fix/cog-cask-postflight-xattr
Apr 1, 2026
Merged

Fix cog cask postflight xattr referencing wrong filename#32
markphelps merged 1 commit intomainfrom
fix/cog-cask-postflight-xattr

Conversation

@markphelps
Copy link
Copy Markdown
Collaborator

Summary

  • Fixes brew install --cask replicate/tap/cog failing with xattr: No such file during postflight

Problem

The postflight block runs xattr -dr com.apple.quarantine on #{staged_path}/cog, but the downloaded binary is named cog_Darwin_arm64 (or cog_Darwin_x86_64) in the staged directory. The binary stanza creates a symlink with the target name cog in /opt/homebrew/bin/, but does not rename the file in the staged path.

xattr: No such file: /opt/homebrew/Caskroom/cog/0.17.1/cog
Error: Failure while executing; `/usr/bin/env /usr/bin/xattr -dr com.apple.quarantine /opt/homebrew/Caskroom/cog/0.17.1/cog` exited with 1.

Fix

Use Hardware::CPU.arm? to construct the correct binary filename in the postflight block, matching the actual file in the staged directory.

Validation Steps

  1. Uninstall existing cog: brew uninstall --cask cog
  2. Untap and re-tap with this branch:
    brew untap replicate/tap
    brew tap replicate/tap https://github.com/replicate/homebrew-tap --branch fix/cog-cask-postflight-xattr
    
  3. Install: brew install --cask replicate/tap/cog
  4. Verify install succeeded without errors
  5. Verify binary works: cog --version

The postflight block referenced staged_path/cog, but the downloaded
binary retains its original name (cog_Darwin_arm64 or cog_Darwin_x86_64)
in the staged directory. The binary stanza only creates a symlink with
the target name, it does not rename the source file.

This caused 'xattr -dr com.apple.quarantine' to fail with
'No such file' on every install.
@markphelps markphelps merged commit 7d2183b into main Apr 1, 2026
3 checks passed
@markphelps markphelps deleted the fix/cog-cask-postflight-xattr branch April 1, 2026 13:00
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