# XKILL, but for macos

# Make them go away

Various applications crash sometime on my work mac, leaving their small annoying windows open, with no obvious recourse to make them go away. I had another instance of that recently, when chrome crash, and the 'Report issue' window opened and also crashed - and I couldn't get it to close.

Clicking the red button did not help, `Right Click + Quit` did not help, `CMD + Q` did not help. I couldn't figure out what process owns that window, so I couldn't `grep` & `kill` my way out of it.

```image
src: https://media.aezakmi.top/blog-images/articles/90ed9426-7eef-4c47-ab5a-3203882d5393/860f6bcb-75ad-4b5d-bd05-d4f136ef8740.webp
alt: screenshot of the macos window buttons
caption: macos window buttons are 100% cosmetic
```

Finally I gave up and told my goon Claude to take care of this, which he grimly did. Using some more trial and error grepping, he found the process, got it's pid and killed it.

I also had similar issue with the [AWS VPN client](https://aws.amazon.com/vpn/client-vpn-download/) app, that tends to open a couple of windows, one normal, one for update, one for connection error, and if you want to close it you need to close it 'in order' from the top, otherwise the buttons are not clickable at all.

I did not have this issue on my linux machines, because I've always used a little util called [xkill](https://xorg.freedesktop.org/archive/current/doc/man/man1/xkill.1.xhtml). You run it from the terminal, click the offending window and it gets nuked immediatley. 

```image
src: https://media.aezakmi.top/blog-images/articles/90ed9426-7eef-4c47-ab5a-3203882d5393/226c4110-bce3-49dc-916b-aac5ae4a5c5f.webp
alt: xXProcessKillerXx
caption: me on the right
width: 400
height: 224
```

I couldn't find similar tool in mac, so I prompted one out.

# mxkill

It's just `xkill` but for mac. You can run it from the terminal, then pick a window and make it go away.

```image
src: https://media.aezakmi.top/blog-images/articles/90ed9426-7eef-4c47-ab5a-3203882d5393/1eba19ab-1c71-4861-9ff1-28ac695ca84c.webp
alt: image.webp
caption: who are you? don't care
```

It works for a lot of UI parts, you can kill the desktop widgets, app on a tray, or if you click on the wifi or battery icons, you can kill the 'Control Center' which I thought is very funny.

You can [find the source here](https://github.com/JakubSokolowski/mxkill). The terminal from which it runs needs to have accessibility permissions. Check it out!

## Showcase

```image
src: https://media.aezakmi.top/blog-images/articles/90ed9426-7eef-4c47-ab5a-3203882d5393/c69bae78-98da-4eaf-98da-8f2c6b02d484.webp
alt: screenshot of the clocks widget on mac, with the terminal running mxkill
caption: can't kill them fast enough, they will come back after 1 second.
```

```image
src: https://media.aezakmi.top/blog-images/articles/90ed9426-7eef-4c47-ab5a-3203882d5393/b6add50e-c236-4c52-b583-c51cbb546bed.webp
alt: image.webp
caption: use case for killing your control center?
```

```image
src: https://media.aezakmi.top/blog-images/articles/90ed9426-7eef-4c47-ab5a-3203882d5393/fbacedb2-5285-4ae4-8503-bc466633f884.webp
alt: image.webp
caption: can't kill this one unfortunatley, I get "mxkill: sent signal 15 to coreautha [pid 83327]" but it's still there...
```

```image
src: https://media.aezakmi.top/blog-images/articles/90ed9426-7eef-4c47-ab5a-3203882d5393/ed25e499-4a31-4e54-b8bd-42a4c26b9772.webp
alt: image.webp
caption: mxkill: sent signal 15 to Notification Centre [pid 96454], but it will restart
```