SwiftGen "Killed: 9" 在启动时因为 "Code Signature Invalid",但前提是通过 Homebrew 安装

SwiftGen "Killed: 9" at startup because "Code Signature Invalid", but only if installed via Homebrew

我通过 Homebrew 在新的 MacBook Pro M1 运行ning Big Sur (11.1) 上安装了最新(6.4.0,2020 年 10 月)版本的 SwiftGen,但每次我尝试运行它,它被杀死了,控制台说这是因为EXC_BAD_ACCESS (Code Signature Invalid)

直接从 the GitHub release page 下载的 6.4.0 二进制文件有效。 这听起来像是 Homebrew 版本有问题。

相关的控制台位是:

Process:               swiftgen [94658]
Path:                  /usr/local/Cellar/swiftgen/6.4.0/bin/swiftgen
Identifier:            swiftgen
Version:               ???
Code Type:             ARM-64 (Native)
Parent Process:        bash [562]
Responsible:           Terminal [498]
User ID:               501

Date/Time:             2021-03-04 23:01:01.231 -0500
OS Version:            macOS 11.1 (20C69)
Report Version:        12
Anonymous UUID:        foo

Sleep/Wake UUID:       bar

Time Awake Since Boot: 110000 seconds
Time Since Wake:       7300 seconds

System Integrity Protection: enabled

Crashed Thread:        Unknown

Exception Type:        EXC_BAD_ACCESS (Code Signature Invalid)
Exception Codes:       0x0000000000000032, 0x0000000100bb0000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace CODESIGNING, Code 0x2

kernel messages:

Backtrace not available

我解决了问题的第二部分。解压后的文件需要复制到/usr/local/Cellar/swiftgen/6.4.0.