Why can’t I open that document? Troubleshooting LaunchServices

Christian’s comment was intriguing:
Open this Webpage in Firefox, switch to Reader-Mode (this tiny icon in the url-field) and drag the location out of the url-field to the desktop. This should create the file “Last Week on My Mac- mid-life mistakes.inetloc” on the desktop. Now double-click that.

What happened when I double-clicked the inetloc bookmark on my Mac? Absolutely nothing: it didn’t open in an app, nor did any app start up to try to open it. What is perhaps more puzzling is that using the Finder’s contextual menu to see what can open this mysterious file shows that nothing can – the Open With command is empty.

Repeat the same procedure using Safari, and instead of the bookmark being an inetloc file, it’s a webloc file, which opens fine in Safari and can also be opened by any other browser, including Firefox. So why doesn’t the inetloc version work too?

how2openadocument

To understand what might be going wrong, here’s a simplified diagram of how opening a document like this works in macOS. Much is the responsibility of LaunchServices, and centres on UTIs (Uniform Type Identifiers). The UTI of that document is determined first, as that established which app should open it.

LaunchServices maintains a database which maps all known UTIs to their primary editor app. So for most Macs, JPEG images have the extension .jpg, .jpeg, or .jpe, and those map to the UTI public.jpeg. The primary editor app for that UTI is (by default) Preview. You can of course change that using the Finder’s Get Info dialog, both to make individual exceptions and globally.

LaunchServices associates apps with UTIs on the basis of what is declared in their Info.plist files. When an app claims that it can open or edit a particular file type, it does that by stating so for that document UTI in the entries in its Info.plist.

Look at the inetloc document using Finder’s Get Info and there’s clearly a problem: macOS recognises its Kind as “Internet location”, but doesn’t list an app in the Open with: section.

I used my Precize utility to reveal that this inetloc file has a UTI of com.apple.generic-internet-location (given in the Type box), then pasted that into UTIutility to find out more about that UTI. It’s described simply as an “Internet location”, which is descended from the more generic UTI of com.apple.internet-location.

This is quite different from Safari’s webloc bookmark document, which has a UTI of com.apple.web-internet-location, and is also descended from com.apple.internet-location.

The next task was to open Firefox’s Info.plist using BBEdit. Unsurprisingly, there is no mention there of inetloc extension, or a UTI of com.apple.generic-internet-location. Not only that, but if I try to drag the inetloc bookmark onto Firefox or Safari, neither responds to my invitation to open the document.

What I suspect to be the problem is that the com.apple.generic-internet-location UTI was previously mapped to the default browser by macOS, perhaps in WebKit, but that Apple has recently changed that, possibly even unintentionally. Supporting that is the fact that you can’t change the app with which to open either webloc or inetloc documents in their Get Info dialog: that function is disabled, most probably because that setting is determined by the default browser setting instead.

I finally looked inside the two types of bookmark files, the standard webloc and Firefox’s inetloc. They are both Property Lists containing a single key-value entry for the URL. In the case of webloc, this is a regular URL, in this case
https://eclecticlight.co/2019/01/27/last-week-on-my-mac-mid-life-mistakes/
but the inetloc contains a URL dressed up with a call to Firefox’s Reader:
about:reader?url=https%3A%2F%2Feclecticlight.co%2F2019%2F01%2F27%2Flast-week-on-my-mac-mid-life-mistakes%2F

It looks like Firefox has a bug, and is writing out bookmarks which it can’t read, nor can LaunchServices map their file type to anything normally usable. However, the cause of this bug appears to be macOS, which no longer maps the UTI com.apple.generic-internet-location and extension inetloc to the default browser.

If you do have bookmarks saved as inetloc files and want to use them, you should be able to extract their URL using an editor like BBEdit. Simply changing their UTI by replacing their extension with webloc doesn’t help though.

Because these inetloc files can’t be mapped to an app, trying to open them will send Finder, LaunchServices and some other supporting services into a bit of a spin, and may also confuse QuickLook when trying to generate a thumbnail for them. It’s best to hide them away for now, or trash them if you can, until someone sorts this problem out.