kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.62k stars 987 forks source link

0.24.0 crashes on macOS, M1 Pro machine #4420

Closed rockyzhang24 closed 2 years ago

rockyzhang24 commented 2 years ago

Describe the bug Installed kitty via homebrew. Click the icon to open it but it crashes immediately. Tried to restart my laptop, the issue was still there. Also tried to download the macOS.dmg directly, and same issue happened.

BTW, the previous version 0.23.1 worked well.

To Reproduce On macOS, run brew install kitty. Then click kitty icon.

Environment details

macOS version: 12.1
machine: MacBook Pro with Apple Silicon (M1 Pro)

Additional context In iTerm2, run kitty --config NONE, same issue.

Thanks.

kovidgoyal commented 2 years ago

I'm afraid I dont support homebrew, use the official kitty binaries. https://sw.kovidgoyal.net/kitty/binary/

rockyzhang24 commented 2 years ago

Okay. I will try that. Thank you very much. However, why the macOS dmg in the releases crashes as well? Thanks.

kovidgoyal commented 2 years ago

Doesnt crash for me. If it is actually crashing, post the crash report.

rockyzhang24 commented 2 years ago

Tried the binaries already and it crashed again. How can I get the crash report? Please apologize for my limited knowledge.

I re-downloaded the 0.23.1 from the releases and it works perfectly. Only 0.24.0 crashes.

kovidgoyal commented 2 years ago

When a program crashes on macOS, macOS will popup a dialog with a button to see the crash report. If you arent getting that then it isnt crashing.

rockyzhang24 commented 2 years ago

Sorry for my inaccurate word. After clicking the icon or run kitty --config NONE from another terminal, the kitty window appears but quits immediately. No other messages or dialog popups. Please see the demo below. Thanks.

https://user-images.githubusercontent.com/11582667/148013557-2b9b2968-6004-4b48-84b1-6ccadb51c8f8.mov

kovidgoyal commented 2 years ago

That will be because the shell is exiting. Run kitty as

kitty --hold

to see the error message from the shell.

rockyzhang24 commented 2 years ago

Okay. After running kitty --hold in iTerm2, a kitty window is open, however, no error messages.

image
kovidgoyal commented 2 years ago

I am totally confused. Are you saying running:

kitty

causes kitty to exit immediately but adding --hold causes it to work normally?

page-down commented 2 years ago

I noticed in the screenshot of the kitty --hold that the prompt is in red, does this mean that the shell rc is running with an error (non-zero exit code)?

Does this seem to be related to shell integration?

kitty --config=NONE -o shell_integration=disabled
rockyzhang24 commented 2 years ago

@kovidgoyal Yes. In iTerm2, if I run kitty without any arguments given or kitty --config NONE, it exits immediately. If I run kitty --hold, it works well, i.e., a kitty window is open.

I am confused as well because 0.23.1 version works perfectly, but 0.24.0 not.

Thanks.

kovidgoyal commented 2 years ago

Add shell_integration disabled to your kitty.conf and you will be fine.

rockyzhang24 commented 2 years ago

It works after adding shell_integration disabled in my kitty.conf. Does that mean the new feature, shell integration, cannot work on macOS?

kovidgoyal commented 2 years ago

No, it means you have something in your shell rc files that is breaking it.

rockyzhang24 commented 2 years ago

I'm using zsh and how can I figure out what is breaking this cool feature quickly? Any ideas? Thank you so much.

page-down commented 2 years ago

You need to find what particular configuration in your shell rc that is causing the problem.

For example, comment out each line of the script and find the line that is causing the problem.

Or move ~/.zshrc and add the previous script one paragraph at a time until something goes wrong. For zsh plugins, you can remove all and then add them one by one.

I'm not sure if set -x will help when troubleshooting shell rc issues.

rockyzhang24 commented 2 years ago

@page-down Okay. I will try to figure it out. I thought probably there would be some shortcuts I could go through to find it. :) Thanks.

@kovidgoyal Is it possible show some error messages when kitty exits due to the conflicts between shell integration and some zsh configurations?

kovidgoyal commented 2 years ago

There are no error messages from kitty. Your shell is failing, and its not printing any error messages, if it did, they would show up when using --hold. Why its doing that, I have no idea. In general I suggest you prune your zshrc to what you actually need/use/understand.

rockyzhang24 commented 2 years ago

I figured it out.

The zimfw/input plugin makes kitty exit. I uninstalled it and kitty works well now. I have little knowledge about zsh so I have no idea which line in https://github.com/zimfw/input/blob/master/init.zsh causes this issue. I will open an issue at that repo to see whether its author @ericbn has ideas.

Thank you guys for your patience and helping me solve this issue.

rockyzhang24 commented 2 years ago

@kovidgoyal I find that line 113, https://github.com/zimfw/input/blob/master/init.zsh#L113, causes this issue. I have no ideas what is the meaning of this line. Do you think whether it can be fixed on kitty's side? Thanks a lot.

kovidgoyal commented 2 years ago

I highly doubt its that line causing the issue, indeed sourcing the entire init.zsh file causes no issues in kitty 0.24 for me with shell integration enabled.

rockyzhang24 commented 2 years ago

I commented that line and then I can opened kitty and kitty worked normally.

kovidgoyal commented 2 years ago

Yeah that's likely because that line is interactiong with something else in your zsh config. Use an empty zsh config with only init.zsh sourced and see if it still breaks.

rockyzhang24 commented 2 years ago

After further investigation, I found that if I kept zimfw/input installed but uninstalled these two plugins zsh-syntax-highlighting and zsh-history-substring-search. Kitty still works normally. Based on your test (sourced zimfw/input/init.zsh directly and kitty was still alive), I think the issue is caused by these two plugins, not zimfw/input.

However, if I just uninstalled either one, the issue existed. I had to uninstall both to make kitty work normally. These two plugins are zsh community driven and they are very popular. They are very complicated so I don't know how to dig into deeply to find the concrete lines causing this issue. Any ideas?

Thank you so much.

kovidgoyal commented 2 years ago

I have no idea. Using zsh-syntax-highlighting and zimfw/input works fine for me with kitty's zsh integration.

rockyzhang24 commented 2 years ago

That's weird. Do you install the whole zimfw or just source zimfw/input/init.zsh? I am using zimfw framework. I uninstalled all the other plugins but just kept zsh-syntax-highlighting and zimfw/input (both were installed via zmodule in .zimrc file), issue still existed.

Thank you very much anyway.

rockyzhang24 commented 2 years ago

Just to mention that this issue was solved after upgrading to 0.24.1. Thanks @kovidgoyal