gitk 无法在 macOS 10.14 (Mojave) 上启动

gitk fails to launch on macOS 10.14 (Mojave)

当我尝试在 macOS Mojave (10.14.4) 上 运行 gitk 时出现以下错误:

Error in startup script: file:///System/Library/ScriptingDefinitions/CocoaStandard.sdef:2: I/O warning : failed to load external entity "file://localhost/System/Library/DTDs/sdef.dtd"
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">
                                                                            ^
file:///System/Library/PrivateFrameworks/FolderActionsKit.framework/Versions/A/Resources/FolderActions.sdef:2: I/O warning : failed to load external entity "file://localhost/System/Library/DTDs/sdef.dtd"
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">
                                                                            ^
    while executing
"exec osascript -e [format {
        tell application "System Events"
            set frontmost of processes whose unix id is %d to true
        end te..."
    invoked from within
"if {[tk windowingsystem] eq "aqua"} {
    exec osascript -e [format {
        tell application "System Events"
            set frontmost of processes ..."
    (file "/usr/local/bin/gitk" line 12212)

我已经尝试解决与启动 gitk 时报告的看似相似的问题(重启 SystemEvents,检查旧的 .osax 脚本添加,从自制程序重新安装 git,等等),但是没有运气。我还检查了终端是否有权访问系统事件。谷歌搜索错误消息似乎没有发现任何相关内容。

gitk 在以前的 macOS 版本上对我来说一直很完美。

这似乎与 Git 或 gitk 没有关联,因为过去曾出现过同样的错误:

最后一个包括:

Sanity checking with others an apparently /System/Library/DTDs/sdef.dtd is there for them.
I've got a copy of the file and appledoc now works as advertised

因此,请先检查该文件是否存在,如果您可以从在不同 Mac 10.14 上获得的副本进行替换,则可以排除导致此问题的特殊原因。

Op Paul R confirms :

going back through Time Machine backups it seems that sdef.dtd inexplicably disappeared some time in late March 2019.

I restored it from backups (ironically had to disable System Integrity Protection (SIP) in order to do this of course - you would think that SIP would prevent this kind of thing happening in the first place ?) and all is good now.