Search code examples
gitmacosmacos-mojavegitk

gitk fails to launch on macOS 10.14 (Mojave)


I get the following error when I try to run gitk on macOS Mojave (10.14.4):

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)

I've tried solutions for seemingly similar reported problems with launching gitk (restart SystemEvents, check for old .osax scripting additions, re-install git from homebrew, etc), but no luck. I've also checked that Terminal has permission to access System Events. Googling the error message doesn't seem to turn up anything relevant.

gitk has always worked perfectly for me on previous versions of macOS.


Solution

  • That does not seem linked to Git or gitk, since the same error was seen in the past:

    The last one includes:

    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

    So start with checking if that file is there, and if you can replace from a copy obtained on a different Mac 10.14, that would rule out that particular cause for this issue.

    The Op Paul R confirms in the comments:

    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.