git-gui command crashes on macOS Sierra

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?


Solution 1:

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:

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