1

The macOS system recognizes various files as JavaScript. If the filename extension is .js, .jscript, .javascript or .mjs, the file's Uniform Type Identifier (UTI) is com.netscape.javascript-source and the file is considered to be JavaScript. This list of filename extensions is 'hard-coded' in /System/Library/CoreServices/CoreTypes.bundle/Contents/Info.plist, where that UTI is defined in a dictionary entry with this subkey:

<key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <array> <string>js</string> <string>jscript</string> <string>javascript</string> <string>mjs</string> </array> <key>public.mime-type</key> <array> <string>text/javascript</string> </array> </dict> 

I would like to add another filename extension to the set that identifies JavaScript files on my Mac. The extension .jsm is often used with the same meaning as .mjs, a JavaScript module. For example, the source code of Firefox has 484 jsm files and the source code of Thunderbird has 429. If they could have that same UTI, it would become easier to work with them – for example, they'd be treated the same by Quicklook.

Is this possible? Can you override the built-in UTI definition, or somehow add something to it? Editing this system file seems unwise (and will have to be repeated after every OS update). I tried doing it in the Info.plist of an ad-hoc Automator application, and then importing that app with lsregister, but have so far had no luck. My question is similar to this one, but more specific.

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.