Show HN: Infat – Declaritive application assocation manager for macOS
94 philocalyst 41 4/24/2025, 5:37:52 PM github.com ↗
Bello! Made this to help navigate the tumultuous process of navigating to a new machine on Mac when you have a number of custom utilities setup for editing particular files. This is designed to make that as easy as possible, and add some magic on top of that, like setting mailto handlers or anything else of that breed. Use XDG_CONFIG_HOME to keep it organized.
Credit to https://github.com/moretension/duti for the original inspiration for the project.
Happy to answer and help with whatever.
Every time I install Chrome on my machine (for testing purposes), macOS decides that Chrome is going to be the default file handler for a bunch of file associations, including HTML, WebP, and so on… and I have to figure out which was which for all of the mappings (which is super frustrating).
I can read Info.plist from the bundle of the specific app (in this case, Google Chrome) that declares all of the UTIs, and then figure out which file associations that Chrome has messed up, but I don’t know how to get the default file associations (if it was not Chrome) before it.
The information below does not "block an app" from taking over file handler associations. It may be beneficial on its own and/or provide a starting point for further exploration.
> Every time I install Chrome on my machine (for testing purposes), macOS decides that Chrome is going to be the default file handler for a bunch of file associations, including HTML, WebP, and so on… and I have to figure out which was which for all of the mappings (which is super frustrating).
The following command can display current file extension associations for a user account:
In the XML output of the above should be the associations. As for determining changes, if Time Machine has been enabled, then changes to this plist can be identified.Also regarding a Chrome OS-X/macOS installation - it installs plists for unconditional background updates. This may not be a desirable feature.
In the next release of Infat, I'm introducing listing the openers from the plist (As you're doing now). If you record these values, then get their set defaults through infat, you could put those into your config and load from you config whenever they're overriden!
Best I got... Shameless promotion
For Google Drive links I open a picker that lets me choose from two chrome profiles and incognito.
https://www.hammerspoon.org/Spoons/URLDispatcher.html
Here's a cleaned up version of my config... I also mapped global cmd-shift-1/2/i to focus my profile and incognito windows (and create a window if none already existed):
https://gist.github.com/beaugunderson/d1ca2218b9b272f3ac3573...
Check back in a week!
As a kind of apology, I made a drop-in hammerspoon config that should accomplish exactly what you wanted: https://gist.github.com/philocalyst/ad9f6d7cc08a9cdefa795e1b...
And if you've never used it before: https://www.hammerspoon.org/go/
I use OpenIn for this [1] (it’s paid, but a one-time purchase at a very reasonable price). It works with URLs too, supports “browser profiles”, and lets you create logic using JavaScript (e.g., do X if the filename contains Y, or do Z if a modifier key is pressed).
It works really well and even has the ability to “fix” what external apps have changed. I plan to use this on new Macs to reconstruct my app associations and rules.
I do wish the rules were defined in plain text files — sometimes it’s hard to follow the logic through the UI and the way it handles things.
Another comment mentions Hammerspoon (which I used in the past — it was very nice). Maybe I can rebuild part of my current setup with it.
[1] https://loshadki.app/openin4/
From quick skim and memory it seems a notable one is url scheme association.
One problem I had with duti is to associate extensions automatically from a pre defined “table”. Automating that involves shell scripting[^1]. Also associating extension to softwares that hasn’t been installed. Another pain point is there’s two ways to associate and depending on different cases one is better than another.
[1]: https://github.com/ickc/bootstrapping-os-environments/blob/m...
Infat list [--identifier] [--application] Where identifier and application are mutually exclusive, and application lists the openers it is capable of opening by default? Merging the application flag for simplicities sake, so either returns a list with both their possibilities *and* the assigned apps.
Thoughts?
swift build -c release
mv .build/PLATFORM/release/infat /usr/local/bin
Could you please try to replicate with verbosity enabled (-v) and email me the output or file an issue at the repo with the results and full summary? It's helpful for tracking. Sorry this isn't a quick fix :(
After running `infat set IINA mov`: https://jezq5q9mfh.ufs.sh/f/Ii8qBn67qEOu1ZUKDXSn3BIE8fDuiWay...
However, does anyone know a way to set all text-like documents to open with a single editor (for example Zed) on Mac? Even text files without any extensions?
I can get it out in a week ;)