Skip to content

Disable UNIX Executable Support #292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
alexclst opened this issue Nov 18, 2024 · 2 comments
Open

Disable UNIX Executable Support #292

alexclst opened this issue Nov 18, 2024 · 2 comments

Comments

@alexclst
Copy link

I also have Apparency installed and would rather it take care of Quick Look for Unix executables. I see in this command line output that this app is handling these:

/usr/bin/pluginkit --match --protocol com.apple.quicklook.preview --platform native --platform maccatalyst --verbose QLSupportedContentTypes=public.unix-executable
+    com.mothersruin.Apparency.QLPreviewExtension(2.2)	83F0C042-B02C-4202-BC19-7782E99600FB	2024-11-18 03:19:06 +0000	/Applications/Apparency.app/Contents/PlugIns/ApparencyPreviewExtension.appex
+    org.sbarex.SourceCodeSyntaxHighlight.QuickLookExtension(2.1.24)	B23DE739-BEC8-41B8-B47F-1682AF311113	2024-10-28 17:01:36 +0000	/Applications/Syntax Highlight.app/Contents/PlugIns/Syntax Highlight Quick Look Extension.appex
 (2 plug-ins)

Yet the file inspector shows that it doesn't, which aligns with it not being in the Formats tab of settings:

Screenshot 2024-11-18 at 10 52 12

So how can I completely disable Syntax Highlight from handling this file format since I want a different extension to do so?

@sbarex
Copy link
Owner

sbarex commented Nov 19, 2024

Is not a simple operation, because every modification break the app signature.

You must edit the Syntax Highlight.app/Contents/PlugIns/Syntax Highlight Quick Look Extension.appex/Contents/Info.plist and remove the occurrence of<string>public.unix-executable</string>. This is used because some terminal scripts are written with bash scripting languages ​​but are recognized as Unix applications.

Alter the edit you must resign the app:

codesign --force --deep --sign - "Syntax Highlight.app"

I not tested if with this modification the app works correctly.

@rsaldinger
Copy link

For what it's worth, I've had luck removing the public.unix-executable UTI, such that Apparency gets a shot.

However, the simple re-signing command shown above will obliterate all of the entitlements. Among other things, that'll prevent macOS from even loading Syntax Highlight's Quick Look extension, because it won't be sandboxed as required.

Fortunately, that problem is easily solved by telling codesign to preserve entitlements, e.g.:

codesign -s - -f --preserve-metadata=entitlements,requirements,identifier,flags,runtime --deep "Syntax Highlight.app"

Here, I told it preserve everything for completeness (no idea if any of those other elements are strictly necessary, though).

I'd previously spent some time trying to figure out a better way to influence which Quick Look Preview extension macOS chooses for a specific UTI, without much success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants