运行 'gitk' 在 MacOS Mojave 上导致神秘的错误消息

Running 'gitk' leads to cryptic error message on MacOS Mojave

我最近开始在我的 MacBook Pro 上使用 MacOS Mojave,从头开始重新安装所有内容,包括通过自制软件安装的最新 git/gitk。我不能肯定地说,但我相信今天是我第一次尝试 运行 gitk 在这台新机器上。当我在我的 iTerm 命令提示符下输入 /usr/local/bin/gitk 时,我得到这个错误:

04:53:06 steve@Barchetta d2 ±|inletfetch2 ✗|→ /usr/local/bin/gitk
2019-06-30 16:53:13.045 Wish[17643:184673] ApplePersistence=NO 
Error in startup script: 2019-06-30 16:53:13.158 osascript[17644:184717] ApplePersistence=NO
    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) [2]+  Exit 1                  /usr/local/bin/gitk $* 2> /dev/null

有一个类似的S.O。涉及相同操作的问题,但错误消息不同,问题中 none 的信息让我解决了问题:

更多 interestingly/strangely,我在 2016 年初最后一次出现 activity 的 Homebrew 板上发现了一个 post 确切的问题:

https://github.com/Homebrew/legacy-homebrew/issues/27862

这个 post 提供了一些建议,none 解决了我的问题,其他人附和 "me too",最后 "resolution" 问题似乎是 "I'll file a bug report with the git crew".

我已确保 brewgit 都已完全更新,我已尝试卸载并重新安装 git,并尝试重新启动我的机器.根据一些谷歌搜索,我试过这个:

defaults write -g ApplePersistence -bool yes

并且还检查了 iTerm 是否具有通过 "System Preferences" -> "Security and Privacy" -> "Privacy" -> "Automation" 授予的 "System Events" 权限

我猜这是一个安全问题,因为 Mojave 以某种方式提高了安全性。当我读到上述设置时,我希望 iTerm 没有被授予适当的权利。但是,唉,他们已经是了。我找不到任何其他信息表明我可以打开可能适用于此问题的任何其他安全设置。

我不知道下一步该怎么做。任何人都可以就正在发生的事情或我应该如何解决这个问题或弄清楚发生了什么提供任何建议吗?

我找到了解决这个问题的方法。我刚刚从 gitk shell 脚本中删除了这些行:

# on OSX bring the current Wish process window to front
if {[tk windowingsystem] eq "aqua"} {
    exec osascript -e [format {
        tell application "System Events"
            set frontmost of processes whose unix id is %d to true
        end tell
    } [pid] ]
}

现在 window 没有出现,但该工具似乎可以正常工作。