Skip to content

Window fails to fully close on MacOS 26 (Tahoe) #8952

Description

@baroldgene

Describe the bug
When using Kitty on MacOS after closing a window (using either cmd+w or exit on the last pane the window doesn't show but seems to still be there. Attempting to click on other applications doesn't work as they seem to be "behind" the non-existent kitty window. In the attached screenshot you can see the empty window when using the expose feature on MacOS.

To Reproduce
Steps to reproduce the behavior:

  1. Open a kitty window
  2. Close the window
  3. Attempt to click on another application anywhere behind where the kitty window was

Screenshots

Image

Environment details

kitty 0.42.2 (b1334fdc19) created by Kovid Goyal
Darwin barrymbp 25.0.0 Darwin Kernel Version 25.0.0: Wed Aug 27 20:24:11 PDT 2025; root:xnu-12377.1.9~17/RELEASE_ARM64_T6000 arm64
ProductName:		macOS ProductVersion:		26.0 BuildVersion:		25A5351b
OpenGL: '4.1 Metal - 90.5' Detected version: 4.1
Frozen: True
Fonts:
  medium: Menlo-Regular: /System/Library/Fonts/Menlo.ttc
          Features: ()
    bold: Menlo-Bold: /System/Library/Fonts/Menlo.ttc
          Features: ()
  italic: Menlo-Italic: /System/Library/Fonts/Menlo.ttc
          Features: ()
      bi: Menlo-BoldItalic: /System/Library/Fonts/Menlo.ttc
          Features: ()
Paths:
  kitty: /Applications/kitty.app/Contents/MacOS/kitty
  base dir: /Applications/kitty.app/Contents/Resources/kitty
  extensions dir: /Applications/kitty.app/Contents/Resources/Python/lib/kitty-extensions
  system shell: /bin/zsh
System color scheme: light. Applied color theme type: none
Loaded config files:
  /Users/skoolie/.config/kitty/kitty.conf

Config options different from defaults:
background_blur               50
background_opacity            0.8
cursor_shape                  2
cursor_trail                  1
cursor_trail_decay            (0.1, 0.3)
enable_audio_bell             False
font_family                   "Hack Nerd Font Propo"
font_size                     18.0
initial_window_height         (600, 'px')
initial_window_width          (800, 'px')
macos_option_as_alt           3
modify_font:
    strikethrough_position 2
    underline_position 9
    underline_thickness 200%
tab_bar_style                 powerline
tab_powerline_style           slanted
transparent_background_colors ((Color(63, 63, 63), -1), (Color(32, 32, 32), -1))
window_border_width           (1.0, 'pt')
Changed shortcuts:
	cmd+k →  clear_terminal_and_scrollback
	ctrl+cmd+, →  reload_config
	ctrl+cmd+l →  clear_screen
	opt+cmd+k →  clear_scrollback
	opt+cmd+r →  reset_terminal
	shift+cmd+/ →  open_kitty_website
Colors:
	active_border_color           #44ffff   

Important environment variables seen by the kitty process:
	PATH                                /Applications/kitty.app/Contents/MacOS:/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin
	LANG                                en_US.UTF-8
	SHELL                               /bin/zsh
	USER                                skoolie

Additional context
Problem persists even when kitty is opened with --config NONE

Activity

  1. kovidgoyal commented on Sep 4, 2025

    @kovidgoyal
    Owner

    Does not reproduce for me on released versions of macOS. Report the
    issue to Apple since you seem to be running a beta macOS. And note that
    if you want kitty to quit when its last window is closed, unlike native
    mac programs, use the option for it in kitty.conf.

  2. baroldgene commented on Sep 4, 2025

    @baroldgene
    Author

    I understand that this is the beta and bugs are expected. But since this version of the OS will be released relatively soon I wanted to give you a head start on looking into the issue.

  3. kovidgoyal commented on Sep 4, 2025

    @kovidgoyal
    Owner

    Sorry, I dont have the spare time to workaround bugs in beta software
    produced by trillion dollar corporations. If macOS is released with
    this bug I will look into finding workarounds, until then, you can
    workaround it yourself trivially in kitty.conf with macos_quit_when_last_window_closed

  4. baroldgene commented on Sep 5, 2025

    @baroldgene
    Author

    I wasn't trying to add to your workload I'm amazed and thankful that you maintain such an awesome app. I thought it might be helpful to know that this seems to be a bug in a major OS that a lot of your users use. For me it's a mild annoyance that I can work around and will continue to use Kitty. In a few weeks it will be a problem for a lot of people and I figured you'd want to know.

    I don't think this is a MacOS "bug" since every other app I run works without issue. More likely a subtle change in how MacOS works that, like it or not, is coming. I'll leave the decision to you on how to handle it, I was just trying to be helpful.

  5. kovidgoyal commented on Sep 5, 2025

    @kovidgoyal
    Owner

    I'm well aware of this, see #8893 or #8882

    It's simply not my policy to waste my time on bugs in pre-release
    versions of macOS. I spend quite enough of my time working around the
    myriad bugs existing in released versions. Not to mention reverse
    engineering the internal details of Cocoa given Apple's appalling lack
    of documentation. As I said if and when the new version is released with
    the bug I will work around it, until then, I live in the hope of a
    modicum of competence for all those trillions of dollars.

    A change of behavior in an OS that silently breaks existing working
    applications with no warning and no deprecation period is clearly a bug
    in the OS. Apple really sucks in that they regularly break working
    applications, in contrast to say Microsoft. Oh well, at least they
    aren't as bad as Wayland.

  6. added a commit that references this issue on Sep 5, 2025
    d837a64
  7. baroldgene commented on Sep 5, 2025

    @baroldgene
    Author

    I'm sorry that Apple is a pain in the ass sometimes. None the less I appreciate you fixing this.

  8. added a commit that references this issue on Sep 5, 2025
    d6594a2
  9. kovidgoyal commented on Sep 5, 2025

    @kovidgoyal
    Owner

    Goes with the territory. Every OS vendor is a pain the ass, in different
    ways :) I am actually not 100% sure this fixes it in all scenarios.
    There is no reason it should be necessary given kitty already calls
    NSWindow::close so this is basically papering over whatever the actual
    issue with NSWindow::close Apple has introduced. Hopefully the papering
    over is sufficient, we will see.

  10. baroldgene commented on Sep 5, 2025

    @baroldgene
    Author

    I'm happy to test it out to see since I can reliably reproduce. I assume this will go into the nightly build by tomorrow? If not I can always try compiling locally.

  11. kovidgoyal commented on Sep 5, 2025

    @kovidgoyal
    Owner

    Yes, nightlies are built from master once every 24 hrs.

  12. 8 remaining items

  13. spreiter commented on Nov 6, 2025

    @spreiter

    I am using 0.44 now (also tried with kitty -c NONE), and do not see this left open clear window, but the kitty icon is still shown when using the expose feature. It does not hurt much, but I just wanted to mention it. Maybe someone has an idea, where this might come from.

    Image
  14. mikaraunio commented on Nov 11, 2025

    @mikaraunio

    Unsure whether the "closed" status means that this should be fixed in the latest release?

    I'm running 0.44.0 on 26.1, and still seeing this.

  15. kovidgoyal commented on Nov 12, 2025

    @kovidgoyal
    Owner

    Fix is too strong a word. Apple's bug has been worked around and yes the
    workaround in in 0.44.0. Does not reproduce on my mac 26.1 anymore.

  16. mikaraunio commented on Nov 12, 2025

    @mikaraunio

    @kovidgoyal thank you. Assumed I was having the same issue, but possibly this is different (or even introduced by the workaround?) What I'm actually seeing is this: occasionally, when I try to click on the desktop, Kitty is activated (Kitty's menus are displayed in the menu bar) instead of the click going to Finder. This has happened even after revealing the desktop with the touchpad gesture.

    Once this happens, I can only get clicks to go to the desktop again by quitting Kitty.

  17. kovidgoyal commented on Nov 12, 2025

    @kovidgoyal
    Owner

    See if this helps you
    2351db7

  18. mikaraunio commented on Nov 12, 2025

    @mikaraunio

    See if this helps you 2351db7

    Sorry that refuses to compile here, complaining typeof is undeclared. Previous commit builds and works fine.

    % git clone https://github.com/kovidgoyal/kitty
    Cloning into 'kitty'...
    [...]
    Resolving deltas: 100% (73339/73339), done.
    % cd kitty
    % ./dev.sh build
    
    Downloading macos-64.tar.xz
    Downloading NerdFontsSymbolsOnly.tar.xz
    Dependencies downloaded. Now build kitty with: ./dev.sh build
    [18/86] Compiling [cocoa] glfw/window.c ... done
    Compiling [cocoa] glfw/cocoa_window.m ...
    clang -MMD -DNDEBUG -D_GLFW_COCOA -D_GLFW_BUILD_DLL -DGL_SILENCE_DEPRECATION -I/Users/mika/Code/kitty/dependencies/darwin-arm64/include -Wextra -Wfloat-conversion -Wno-missing-field-initializers -Wall -Wstrict-prototypes -std=c11 -pedantic-errors -Werror -O3 -fwrapv -fstack-protector-strong -pipe -fvisibility=hidden -fno-plt -D_FORTIFY_SOURCE=2 -flto -mbranch-protection=standard -fPIC -c glfw/cocoa_window.m -o build/glfw-cocoa-glfw-cocoa_window.m.o
    glfw/cocoa_window.m:2327:16: error: call to undeclared function 'typeof'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     2327 |         __weak typeof(nw) weakSelf = nw;
          |                ^
    glfw/cocoa_window.m:2327:16: error: expected identifier or '('
    glfw/cocoa_window.m:2329:22: error: expected identifier or '('
     2329 |             __strong typeof(weakSelf) strongSelf = weakSelf;
          |                      ^
    glfw/cocoa_window.m:2330:17: error: use of undeclared identifier 'strongSelf'
     2330 |             if (strongSelf) strongSelf.collectionBehavior = old;
          |                 ^
    glfw/cocoa_window.m:2330:29: error: use of undeclared identifier 'strongSelf'
     2330 |             if (strongSelf) strongSelf.collectionBehavior = old;
          |                             ^
    5 errors generated.
    The following build command failed: /Users/mika/Code/kitty/dependencies/darwin-arm64/python/Python.framework/Versions/Current/bin/python3 setup.py develop
    exit status 1
    
  19. kovidgoyal commented on Nov 12, 2025

    @kovidgoyal
    Owner

    Yeah, I forgot ARC is not enabled for these. Needed to use __unsafe_unretain but it doesnt fix the zombie window issue anyway, so never mind.

  20. kovidgoyal commented on Nov 12, 2025

    @kovidgoyal
    Owner

    Some further investigation, with the following patch:

    diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m
    index a4c234d09..e0ff60bbb 100644
    --- a/glfw/cocoa_window.m
    +++ b/glfw/cocoa_window.m
    @@ -1939,6 +1939,16 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconf
         return true;
     }
     
    +static void
    +kill_tahoe_ui_window(unsigned long long timer_id UNUSED, void *data UNUSED) {
    +    for (NSWindow *window in [NSApp windows]) {
    +        if ([NSStringFromClass([window class]) isEqualToString:@"TUINSWindow"]) {
    +            // this is a weird nswindow macos creates since Tahoe when you close an NSWindow
    +            NSLog(@"%@ %lu", window, [window retainCount]);
    +        }
    +    }
    +}
    +
     void _glfwPlatformDestroyWindow(_GLFWwindow* window)
     {
         GLFWWindow *w = window->ns.object;
    @@ -1971,6 +1981,7 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
         [w setFrame:frame display:NO];
         [w close];  // sends a release to NSWindow so we dont release it
         window->ns.object = nil;
    +    glfwAddTimer(s_double_to_monotonic_t(0.2), false, kill_tahoe_ui_window, nil, nil);
     }
     
     static NSScreen*

    we see that after closing the NSWindow, sometime later, macOS creates a "TUINSWindow" and that is the zombie window. I am guessing TUI here stands for Tahoe UI. I can find no Apple documentation about this, why it is created, how to prevent is from being created, etc. If I had to guess, I'd say its related to Apple's glass effects.

  21. mikaraunio commented on Nov 12, 2025

    @mikaraunio

    Just guessing here, as indeed there's no proper documentation on this at all:

    Googling would seem to indicate TUINSWindow predates Tahoe. The following hints at TextInputUI being the likely culprit:

    https://developer.apple.com/forums/thread/742826

    We also have the following in the Chromium codebase:

    // Handle ordering groups for AppKit native windows. For instance, the
    // `TUINSWindow` is added and removed by AppKit when caps lock is active.
    // See https://crbug.com/369970893 for more details.
    if (![childWin isKindOfClass:[NativeWidgetMacNSWindow class]]) {
      [self maybeRemoveTreeFromOrderingGroups];
    }
    

    https://chromium.googlesource.com/chromium/src/+/master/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm +278

  22. kovidgoyal commented on Nov 12, 2025

    @kovidgoyal
    Owner

    Yeah, then I guess that's not the cause, which kind of makes sense as
    its frame is 0,0 to 500,500 which is not matching the area of the closed
    window anyway. Printing out the list of windows in that timer callback
    shows that the only window left is the TUINSWindow meaning, the kitty
    window has been properly remove from NSApp.windows. So not sure what
    else to do here. Just live with the bug I guess, or set
    macos_quit_when_last_window_closed to yes in kitty.conf.

  23. spreiter commented on Mar 25, 2026

    @spreiter

    I am using 0.44 now (also tried with kitty -c NONE), and do not see this left open clear window, but the kitty icon is still shown when using the expose feature. It does not hurt much, but I just wanted to mention it. Maybe someone has an idea, where this might come from.

    Image

    I just installed Tahoe 26.4 and this issue is gone. So either they changed something or the installation cleared some leftover stuff :D

  24. added a commit that references this issue on Jul 8, 2026
    b66dec0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions