lgarron / first-world

Issues that are not necessarily easy to report/fix, and are (generally) not a matter of life-or-death.
https://github.com/lgarron/first-world/issues
0 stars 0 forks source link

macOS does not allow `.ts` files to be shown as text in QuickLook #144

Open lgarron opened 2 years ago

lgarron commented 2 years ago

macOS still considers .ts files to be movie files. This has been hardcoded deeper and deeper into the OS over time, resulting in the following:

There are workarounds, but at this point I believe they involve csrutil disable (to disable system integrity protection (SIP)) and hacking a QuickTime Player .plist to remove .ts. Possibly after every OS update.

As someone whose primary programming language is TypeScript, I might be willing to jump through those hoops, but the workarounds are not reasonable for the average programmer. And even I haven't successfully gotten it working yet.

Some references (none of which offer a complete, working solution):

lgarron commented 2 years ago

Okay, I tried replacing /System/Library/CoreServices/CoreTypes.bundle/Contents/Info.plist with an edited version in the recovery mode terminal and failed. :-/

lgarron commented 2 years ago

After restarting: Screen Shot 2022-10-27 at 00 30 47

Editing /System/Library/CoreServices/CoreTypes.bundle/Contents/Info.plist in XCode with SIP disabled:

Screen Shot 2022-10-27 at 00 38 47 Screen Shot 2022-10-27 at 00 38 51

Trying to make the system partition readable:

> sudo mount -uw /
mount_apfs: volume could not be mounted: Permission denied
mount: / failed with 66
lgarron commented 2 years ago

From https://developer.apple.com/forums/thread/649832?answerId=613554022#613554022

Why do you need to modify the root volume? Given the read-only system volume change we announced last year, and its further evolution this year, that’s something best avoided where possible.

My experience is that most of the common use cases for this are covered by synthetic symlinks (see the synthetic.conf man page). Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@apple.com"

That thread also mentions sudo bless, which might be handy.

That thread also implies that changes to /System/Library are more difficult (read: impossible?) than changes to /Library, but unfortunately the required change is in the former.

lgarron commented 2 years ago

Given https://github.com/sbarex/SourceCodeSyntaxHighlight#file-format-management , I think the only remotely practical way forward would be a campaign to convince Apple to allow .ts (and .mts) like they allowed .plist and .xml in recent versions:

MacOS 10.15 Catalina does not allow to manage some file formats including (but not limited to): .xml, .plist, .html, .ts, .dart, .txt, common images (.jpg, .gif, .png), …

On macOS 11 Big Sur, the system allows you to manage these previously unauthorized extensions: .plist.

On macOS 12 Monterey, the system allows you to manage these previously unauthorized extensions: .xml.

lgarron commented 1 year ago

Upgrading this to severe, because: