CryptoFool
CryptoFool

Reputation: 23089

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

I recently started fresh with MacOS Mojave on my MacBook Pro, reinstalling everything from scratch, including the latest git/gitk via homebrew. I can't say for sure, but I believe that today is the first time I've tried to run gitk on this new machine. When I type /usr/local/bin/gitk at my iTerm command prompt, I get this error:

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

There is a similar S.O. question involving the same operation, but the error message is different and none of the information in the question gets me past the problem:

gitk fails to launch on macOS 10.14 (Mojave)

More interestingly/strangely, I found a post for this exact problem on a Homebrew board that last had activity in early 2016:

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

This post offers some suggestions, none of which fix the problem for me, others chime in with "me too", and the final "resolution" of the issue it seems was "I'll file a bug report with the git crew".

I've made sure that both brew and git are fully up to date, I've tried uninstalling and reinstalling git, and I've tried restarting my machine. Per some Googling, I tried this:

defaults write -g ApplePersistence -bool yes

and also checked that iTerm has the "System Events" permission granted via "System Preferences" -> "Security and Privacy" -> "Privacy" -> "Automation"

I'm guessing that this is a Security issue due to Mojave heightening security somehow. When I read of the above settings, I was hopeful that the proper rights hadn't been granted to iTerm. But alas, they already had been. I can find no other information suggesting any other Security settings I can open up that might apply to this problem.

I'm at a loss as to what to do next. Can anyone offer any suggestions as to what is going on or what I should do to fix this or figure out what is going on?

Upvotes: 2

Views: 193

Answers (1)

CryptoFool
CryptoFool

Reputation: 23089

I figured out a way to fix this. I just removed these lines from the gitk shell script:

# 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] ]
}

Now the window doesn't come forward, but the tool seems to otherwise work fine.

Upvotes: 4

Related Questions