52

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?

kenorb
  • 155,785
  • 88
  • 678
  • 743
sbondaryev
  • 839
  • 6
  • 10

14 Answers14

24

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

Nainy Agrawal
  • 341
  • 1
  • 6
23

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
kenorb
  • 155,785
  • 88
  • 678
  • 743
ssahu
  • 878
  • 3
  • 10
  • 22
  • Thank you, the accepted answer didn't work for me, but this does. – yxhuvud Dec 01 '16 at 14:28
  • This answer worked for me, but only after I fixed the issue I had with my PATH variable, which had `/usr/bin/` before `/usr/local/bin`. This had the effect that I couldn't change the version of `Wish` used by `gitk`. – JBL Dec 12 '16 at 11:49
  • 4
    I had to do `brew install homebrew/dupes/tcl-tk` – pius Dec 22 '16 at 22:37
  • did this… it's still crashing for me – Clintm Mar 13 '17 at 04:28
  • 1
    `brew install homebrew/dupes/tcl-tk` no longer works. homebrew/dupes was deprecated. – ebelisle Feb 26 '19 at 18:39
19

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

sbondaryev
  • 839
  • 6
  • 10
  • This did not work for me. The answer by ssahu did work, however. – yxhuvud Dec 01 '16 at 14:27
  • Yes. the ssahu's solution should also work, anyway the idea is to replace the Tcl/tk 8.5 version with another one. You should also use your current git version in the target path of `cp` command. – sbondaryev Dec 01 '16 at 15:39
  • I would recommend upgrading Tk to 8.6 rather than downgrading to 8.4, since 8.4 has its own set of disadvantages. For me, it was annoying that it did not support my macbook's retina display. See answers by ssahu and Bruce for how to do that. – pius Dec 22 '16 at 22:43
  • I tried many solutions and this is the only one that worked for me! Thank you!!! By the way, also pay attention to use your current Tk version. – Dmitry Kamenetsky Apr 15 '20 at 12:57
7

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

Bruce
  • 2,146
  • 2
  • 26
  • 22
5

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

kenorb
  • 155,785
  • 88
  • 678
  • 743
Malachi
  • 2,260
  • 3
  • 27
  • 40
5

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
      
  3. 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
      
  4. 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.

kenorb
  • 155,785
  • 88
  • 678
  • 743
Rotonen
  • 156
  • 2
  • 4
  • Thanks. The alias worked for me on Mojave (10.14.3), and I'm happy to have it for future use. err: Wish[98243:1226829] *** Assertion failure in -[_NSCGSWindow setFrame:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1671.20.108/CGS.subproj/NSCGSWindow.m:1015 2019-03-21 11:55:18.876 Wish[98243:1226829] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: CGRectContainsRect(CGRectMake((CGFloat)INT_MIN, (CGFloat)INT_MIN, (CGFloat)INT_MAX - (CGFloat)INT_MIN, (CGFloat)INT_MAX - (CGFloat)INT_MIN), frame)' – Jason Mar 21 '19 at 17:29
2

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.

Kenn Sebesta
  • 7,485
  • 1
  • 19
  • 21
0

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.

Vadim Motorine
  • 2,973
  • 1
  • 11
  • 7
0

@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
HankCa
  • 9,129
  • 8
  • 62
  • 83
0

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.

jalairo
  • 383
  • 3
  • 4
0

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

kenorb
  • 155,785
  • 88
  • 678
  • 743
James Fry
  • 1,133
  • 1
  • 11
  • 28
  • I'm using macOS Sierra 10.12.5 (August 2017) and the crash was still there. – kenorb Aug 17 '17 at 21:19
  • How did you install git? I'm using the homebrew installation and it's now fine (it appeared to be the Sierra update that fixed it as I didn't update git). I've since reinstalled OSX and reinstalled git using brew and it's working fine (as it does for 2-3 other Mac's I have regular visibility of). I cannot speak for the stability of the git installer from the git website. I'm using a 2015 15" rMBP and 2013 13" rMBP, other Mac is a c. 2013 Air. – James Fry Aug 17 '17 at 21:24
  • I'm using git 2.14.1 installed by brew, I've tried installing `tcl-tk` via `brew` and it helped. – kenorb Aug 17 '17 at 21:26
  • I have the following brew packages only installed - freetds freetype git graphicsmagick imagemagick jpeg libpng libtiff libtool openssl pgloader postgresql readline sbcl xz. I am running 10.12.6 and brew 1.3.0. git --version reports "git version 2.14.0" and `which git` is "/usr/local/bin/git". – James Fry Aug 17 '17 at 21:29
0

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!

0

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
Rammgarot
  • 1,467
  • 14
  • 9
0

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 :)

Yo Ludke
  • 2,149
  • 2
  • 23
  • 38