4

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.

Paul R
  • 208,748
  • 37
  • 389
  • 560
  • 1
    Make sure your terminal program (iterm or terminal) has permission to access system events? This is the same error I get when I remove system event access. – evolutionxbox Apr 23 '19 at 13:01
  • @evolutionxbox: thanks for the suggestion - I just checked that Terminal has permission to access System Events (I even disabled this and re-enabled it just to be sure), so I'm still looking for a solution... – Paul R Apr 24 '19 at 09:14
  • Just to be sure, where did you check the permissions? – evolutionxbox Apr 24 '19 at 09:26
  • @evolutionxbox: sure - in System Prefs/Security & Privacy/Privacy/Automation under the entry for Terminal I have System Events checked. – Paul R Apr 24 '19 at 13:19
  • Fab. I'm sorry that didn't help. I was almost convinced as if I disable access I get the same error (except the `Error in startup script` file part) – evolutionxbox Apr 24 '19 at 15:21
  • Thanks, yes, I was quite excited too, as it seemed a highly plausible solution. I’ll stick a bounty on the question shortly and see if that helps... – Paul R Apr 24 '19 at 15:41
  • Are you using terminal? Or another like iTerm? – evolutionxbox Apr 25 '19 at 17:43
  • Just the standard Terminal app that comes with macOS. I guess I could try an alternative, like iTerm, to see if it gives the same result. – Paul R Apr 25 '19 at 18:15
  • 2
    Have you verified that `/System/Library/DTDs/sdef.dtd` actually exists? – Claus Jørgensen Apr 25 '19 at 20:07
  • @ClausJørgensen: yes, thanks, that was indeed the problem (see VonC's answer below) - it's still a mystery as to how this file disappeared though (maybe during a system software update ?). – Paul R Apr 26 '19 at 08:32

1 Answers1

3

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.

Paul R
  • 208,748
  • 37
  • 389
  • 560
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    Yes, spot on - 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)](https://stackoverflow.com/a/32661637/253056) 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. Bounty to be awarded in due course... – Paul R Apr 26 '19 at 08:30
  • 1
    @PaulR Thank you for your feedback. I have included your comment in the answer for more visibility. – VonC Apr 26 '19 at 09:26