Closed ahmedelgabri closed 2 months ago
Does not reproduce for me steps I tried
1) echo "--single-instance" > ~/.config/kitty/macos-launch-services-cmdline 2) Run
open -a kitty.app
3) kitty opens as expected 4) Quit kitty 5) click kitty dock icon 6) kitty opens as expected 7) In another terminal run
kitty --single-instance
8) A new window in the kitty instance from 6 opens, as expected.
Make sure you have actually quit kitty before editing macos-launch-services-cmdline, maybe try rebooting your machine. And if it doesnt start look in console.app for logs.
I did reboot multiple times, I will have a look at the logs from console.app
@kovidgoyal Hi. I can confirm the bug report. I am on 0.36.2, installed via Homebrew, on Sonoma 14.6.1. As I update regularly, I am sure it worked in previous versions. open -a kitty.app
doesn't show Kitty's window.
cat ~/.config/kitty/macos-launch-services-cmdline
--single-instance
--listen-on unix:/tmp/kitty-main
I almost never open Kitty from dock actually, so let me share the results running from Terminal.app:
/opt/homebrew/bin/kitty --single-instance --listen-on unix:/tmp/kitty-main
Failed to connect to single instance socket: Connection refused
ls -al /tmp/ | grep kitty
returns no results as well.
However, /opt/homebrew/bin/kitty &
works, and then, as I have listen_on unix:/tmp/kitty-main
in kitty.conf
ls -al /tmp/ | grep kitty
srwxr-xr-x 1 igor.epstein wheel 0 12-09-2024 11:54 kitty-main-3203
Console.app doesn't show anything that is related to Kitty, as far as I can tell. How can I help to debug this? Thank you
All options in macos-launch-services-cmdline need to be on a single line.
I fixed macos-launch-services-cmdline, however it changed nothing. Removing single-instance
from there enables Kitty to be opened. Single instance doesn't work from command line as well, as I wrote above
Dont put listen_on in both kitty.conf and the CLI. Pick one.
Moved all the config to "bak", open -a kitty.app
works, single instance with or without listen-on does not - I tried from command line. I will check on Linux and will try to build Kitty on Mac later today
Just found your answer, @kovidgoyal, here. That exactly what happened to me, and probably to @ahmedelgabri
find /private -name 'kitty-ipc*' 2>/dev/null
/private/var/folders/45/v2yv8_9n6hxdrw8kyblfhy100000gn/C/kitty-ipc-501
/private/var/folders/45/v2yv8_9n6hxdrw8kyblfhy100000gn/C/kitty-ipc-501.lock
ll /private/var/folders/45/v2yv8_9n6hxdrw8kyblfhy100000gn/C/kitty-ipc-501
srwxr-xr-x 1 igor.epstein staff 0 12-09-2024 10:47 /private/var/folders/45/v2yv8_9n6hxdrw8kyblfhy100000gn/C/kitty-ipc-501=
And system.log
in Console.app has the following, which I understand as time of reboot: Sep 12 10:48:45 XXX reboot[34432]: SHUTDOWN_TIME: 1726127325 642601
So, probably, stale lock files were left for some reason, that survived reboot. And the reason of reboot was misbehavior of Mac, so maybe it crashed Kitty, preventing lock deletion
Lock files are auto cleaned on reboot, they are in /tmp so it cant be that unless for some reason your mac is not cleaning /tmp and friends on reboot.
As far as I understood from googling, they are not in /tmp https://superuser.com/questions/892647/it-is-safe-delete-osxs-private-var-folders-at-reboot and https://www.swiftforensics.com/2017/04/the-mystery-of-varfolders-on-osx.html
ll /tmp
lrwxr-xr-x 1 root wheel 11 04-08-2024 13:31 /tmp -> private/tmp/
find /private -name 'kitty-ipc*' 2>/dev/null
/private/var/folders/45/v2yv8_9n6hxdrw8kyblfhy100000gn/C/kitty-ipc-501
And this folder with lock files has a lot of things from two month ago, even this
ll /private/var/folders/45/v2yv8_9n6hxdrw8kyblfhy100000gn/C/net.kovidgoyal.kitty/
total 0
drwxr-xr-x 4 igor.epstein staff 128 24-07-2024 21:15 com.apple.metal/
drwxr-xr-x 2 igor.epstein staff 64 24-07-2024 19:55 com.apple.metalfe/
Regardless, locks are in kernel objects that dont survive reboots. Whether the file exists or not it wont be locked.
also IIRC those lock files arent created by up-to-date versions of kitty, only the socket files. So where are they coming from on your system?
kitty --single-instance
find /private -name '*kitty*'
output no .lock files for me
Indeed, the lock files are not there now, only the socket. Were they created up to 0.36.1? Anyway, hopefully the issue of original poster will be resolved this way as well. Thank you for Kitty and for your time
I don't have .lock
files, I only have an kitty-ipc-501
file
$ find /private -name 'kitty-ipc*' 2>/dev/null
/private/var/folders/cm/kq8d76d97m99g0szm14rzstc0000gn/C/kitty-ipc-501
That being said my Mac actually misbehaved and I had to force shut it down, so maybe something here is true.
[…] And the reason of reboot was misbehavior of Mac, so maybe it crashed Kitty, preventing lock deletion
This is currently broken for me too.
If I run /opt/homebrew/bin/kitty --single-instance
or open -n -a kitty.app --args --single-instance
in my terminal no kitty window opens at all.
Once I remove this command, everything works.
MacOS: 14.6.1 Kitty: 14.6.1`
Edit:
I needed to remove some private files as well:
/private/var/folders/k5/16jgcrmj3g57dg8fzy48whzc0000gn/C/net.kovidgoyal.kitty
/private/var/folders/k5/16jgcrmj3g57dg8fzy48whzc0000gn/C/kitty-ipc-501
Now it works, no idea where those came from. I've never ran kitty with an IPC.
I can confirm that deleting the kitty-ipc-501
file fixed my issue too. I didn't have a net.kovidgoyal.kitty
Any one know why this file gets there? I'm assuming kitty crashes and nothing cleans this up?
rm kitty-ipc-501
file and net.kovidgoyal.kitty
dir works for me
also occurred the same issue after upgrade to 0.36.2
Describe the bug I can't launch kitty with
--single-instance
inmacos-launch-services-cmdline
I know this was supposed to be fixed in0.36.1
but I'm on0.36.2
and it doesn't work still.To Reproduce Steps to reproduce the behavior:
mkdir ~/.config/kitty
echo "--single-instance" > ~/.config/kitty/macos-launch-services-cmdline
Alternative step:
Run the following from the terminal
Environment details