git-gui command crashes on macOS Sierra

GitMacosCrash

Git Problem Overview


After update to macOS Sierra, git-gui command crashes with an error:

Wish[23862:202062] *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [0 nan]'
*** First throw call stack:
(
0   CoreFoundation                      0x00007fff8cd9252b __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x00007fffa146acad objc_exception_throw + 48
2   CoreFoundation                      0x00007fff8ce10a0d +[NSException raise:format:] + 205
3   QuartzCore                          0x00007fff92938980 _ZN2CA5Layer12set_positionERKNS_4Vec2IdEEb + 152
4   QuartzCore                          0x00007fff92938af5 -[CALayer setPosition:] + 44
5   QuartzCore                          0x00007fff9293914b -[CALayer setFrame:] + 644
6   CoreUI                              0x00007fff986e2112 _ZN20CUICoreThemeRenderer26MakeOrUpdateScrollBarLayerEPK13CUIDescriptoraPP7CALayer + 1284
7   CoreUI                              0x00007fff986de317 _ZN20CUICoreThemeRenderer19CreateOrUpdateLayerEPK13CUIDescriptorPP7CALayer + 1755
8   CoreUI                              0x00007fff986604d1 _ZN11CUIRenderer19CreateOrUpdateLayerEPK14__CFDictionaryPP7CALayer + 175
9   CoreUI                              0x00007fff98663185 CUICreateOrUpdateLayer + 221
10  AppKit                              0x00007fff8b3c7623 -[NSCompositeAppearance _callCoreUIWithBlock:options:] + 226
11  AppKit                              0x00007fff8aa74a9d -[NSAppearance _createOrUpdateLayer:options:] + 76
12  AppKit                              0x00007fff8aced143 -[NSScrollerImp _animateToRolloverState] + 274
13  AppKit                              0x00007fff8acacb79 __49-[NSScrollerImp _installDelayedRolloverAnimation]_block_invoke + 673
14  AppKit                              0x00007fff8ab73331 -[NSScrollerImp _doWork:] + 15
15  Foundation                          0x00007fff8e770c88 __NSFireDelayedPerform + 417
16  CoreFoundation                      0x00007fff8cd11e14 CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION + 20
17  CoreFoundation                      0x00007fff8cd11a9f __CFRunLoopDoTimer + 1071
18  CoreFoundation                      0x00007fff8cd115fa __CFRunLoopDoTimers + 298
19  CoreFoundation                      0x00007fff8cd09021 __CFRunLoopRun + 2065
20  CoreFoundation                      0x00007fff8cd085b4 CFRunLoopRunSpecific + 420
21  Tcl                                 0x0000000101834b43 Tcl_WaitForEvent + 314
22  Tcl                                 0x00000001018045cd Tcl_DoOneEvent + 274
23  Tk                                  0x0000000101672f4f Tk_MainLoop + 33
24  Tk                                  0x000000010167ea5b Tk_MainEx + 1566
25  Wish                                0x0000000101658542 Wish + 9538
26  libdyld.dylib                       0x00007fffa1d48255 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
error: git-gui died of signal 6
Does anybody have the same problem and a solution for this?

Git Solutions


Solution 1 - Git

Try: git config --local --unset gui.geometry
This error occurs due to Tk Geometry manager does not work, due to older version or if it is corrupt.

If the above command didn't work try updating your xcode: xcode-select --install

Solution 2 - Git

Instead of using the default MacOS tcl-tk, use the latest tcl-tk(8.6.6) from Homebrew and then link it by force, for example:

brew install tcl-tk
brew link tcl-tk --force

Solution 3 - Git

There is a problem with Tk 8.5 on MacOS Sierra. You could replace Tk Wish 8.5 with Tk Wish 8.4

cp /System/Library/Frameworks/Tk.framework/Versions/8.4/Resources/Wish.app/Contents/MacOS/Wish /usr/local/Cellar/git/2.10.1/share/git-gui/lib/Git\ Gui.app/Contents/MacOS/

source: https://github.com/git/git-scm.com/issues/853

UPD: Pay attention to replace the git version in the cp path with your current version

Solution 4 - Git

My solution, should work for the git download from https://git-scm.com/

brew install homebrew/dupes/tcl-tk

cd to /usr/local/git/share/git-gui/lib/Git Gui.app/Contents/MacOS and backup the original Wish

cp /usr/local/Cellar/tcl-tk/8.6.6/bin/wish8.6 /usr/local/git/share/git-gui/lib/Git Gui.app/Contents/MacOS/Wish

Solution 5 - Git

I conglomerated a bunch of answers from here together, since I am using GIT and TCL via brew:

  1. cd "/usr/local/Cellar/git/2.10.2/share/git-gui/lib/Git Gui.app/Contents/MacOS"
  2. mv Wish Wish.bkp
  3. ln -vs /usr/local/Cellar/tcl-tk/8.6.6/bin/wish8.6 Wish

Over time obviously the version numbers may vary

Solution 6 - Git

I consider the following goals to constitute the full solution to the problem:

  • "Nuke from orbit" certainty in solving this in a neat and linear fashion

  • Do not end up with ugly fonts from a legacy Apple Tcl/Tk

  • Decouple your git gui from the Apple shipped Tcl/Tk

    • Rely on Homebrew for your Tcl/Tk installation

Below you will find a step-by-step to achieve this:

  1. Get the duplicated Tcl/Tk from Homebrew

     brew install tcl-tk
    
  2. Add the non-broken Tcl/Tk installation to the path(s) before the broken Apple implementation

  • This assumes your Homebrew paths take precedence over your system paths

  • This should be the case in a normal Homebrew installation

  • This will fail if you have conflicting files from your other installed homebrew recipes

  • For example the_platinum_searcher provides pt, which conflicts

  • I recommend ripgrep for getting around this case

        brew link --force tcl-tk
    
  1. Fix your gitk installation by reinstalling against the nonbroken Homebrew version
  • This might not be necessary, but ref. the first stated goal above

        brew reinstall git
    
  1. Copy the new wish binary from your Homebrew Tcl/Tk installation over the broken bundled one from Apple in the Git Gui.app bundle
  • This blindly relies on the ouput of homebrew info <package> to not change

        cp "$(which wish)" "$(brew info git | grep Cellar | cut -d' ' -f1)/share/git-gui/lib/Git Gui.app/Contents/MacOS/Wish"
    

The last bit might be wise to slap into an alias into your ~/.bashrc and/or equivalent as it'll have to be repeated every time you get a new git version from Homebrew.

alias fix-gitgui='cp "$(which wish)" "$(brew info git | grep Cellar | cut -d" " -f1)/share/git-gui/lib/Git Gui.app/Contents/MacOS/Wish"'

I am not fully certain why the quoting for the field delimiter character for cut used above works so use this alias with caution as this might very well depend on an exact bash version.

Solution 7 - Git

Upgrading to macOS 10.12.2 fixes the problem.

References:

No insight into why from Apple change log: https://support.apple.com/en-us/HT207307.

Solution 8 - Git

It works for me: download and install the latest version of TCL (I used 8.6.4) http://www.activestate.com/activetcl/downloads

I also downloaded and installed the latest version (2.10.1) of git https://git-scm.com/

Check that gitk window does not crash after the resizing.

Solution 9 - Git

@sbondaryev's answer (39966704) didn't work for me and I've yet to try @ssahu's (40119030). However the trick I describe here crashed far less often (10% of time or so) for me. And it keeps me from messing around too much with things - hopefully the problem will be fixed properly soon.

  • Crashing seemed to happen when resizing the window (90% of time). But I found it too small to work with and wanted to resize it.
  • vi .git/config
  • edit the GUI geography to create a window size that works. I still kept it small though i suspect there will be a size over which crashing will always happen

Solution 10 - Git

My Sierra (upgraded from 10.11.6) has Tcl/Tk Current pointing to 8.5 and I observed the same error after the upgrade, with our Python program using Tkinter. I'm not using Wish. I had no help from Python 2.7 32bit installation linked to Tcl/Tk 8.4 as that one did not have "tile". So I brewed my Python, linking it with Tcl/Tk 8.6:

This is for brew to use precompiled bottles instead of building from sources, unless specifically instructed otherwise, so not really causing the issue:

xcode-select --install

Then install Tcl/Tk:

brew install homebrew/dupes/tcl-tk

If you did not install Python originally with --with-tcl-tk, then:

brew uninstall python

Finally:

brew install python --with-tcl-tk

After this I have Python that is linked to Tcl/Tk 8.6 and looks like I got rid of the error.

Solution 11 - Git

This has been resolved on the most recent patches to macOS Sierra (10.12.2 and above) and no further action is necessary.

Solution 12 - Git

After a lot of struggles this solution solves my problem:

$ brew upgrade tcl-tk

If it's up-to-date and this does not work, try:

$ brew uninstall tcl-tk
$ brew install tcl-tk

I have tried every solution in the web but only this solves the problem. Cheers!

Solution 13 - Git

On High Sierra (10.13) I had the same issue with git gui.

I have solved the issue by updating git from 2.7.0 to 2.14.2

brew upgrade git

Solution 14 - Git

A fix that worked for me: disconnect second monitor, open git gui -> works, close it, reconnect the second monitor and run git gui -> works again :)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionsbondaryevView Question on Stackoverflow
Solution 1 - GitNainy AgrawalView Answer on Stackoverflow
Solution 2 - GitssahuView Answer on Stackoverflow
Solution 3 - GitsbondaryevView Answer on Stackoverflow
Solution 4 - GitBruceView Answer on Stackoverflow
Solution 5 - GitMalachiView Answer on Stackoverflow
Solution 6 - GitRotonenView Answer on Stackoverflow
Solution 7 - GitKenn SebestaView Answer on Stackoverflow
Solution 8 - GitVadim MotorineView Answer on Stackoverflow
Solution 9 - GitHankCaView Answer on Stackoverflow
Solution 10 - GitjalairoView Answer on Stackoverflow
Solution 11 - GitJames FryView Answer on Stackoverflow
Solution 12 - GitPetyoKostakovView Answer on Stackoverflow
Solution 13 - GitRammgarotView Answer on Stackoverflow
Solution 14 - GitYo LudkeView Answer on Stackoverflow