I searched for a replacement for the feature to enable syntax preview on macOS when I found out that QLColorCode was not working on macOS Catalina 10.15.
It’s frustrating to work with source code if you have to open each of them in the text editor. Quick Look offers the advantage of previewing documents without having to open it first since the day of OS X Leopard.
Apple tightened the security on macOS with Gatekeeper and System Integrity Protection to prevent malicious software from modifying protected files and documents on your Mac.
I tried to install the my favorite Quick Look extensions back on macOS Catalina and found out that none of them were working. It turned out macOS Catalina had deprecated the qlgenerator APIs.
These Quick Look plugins are broken unless they’re official signed.
MacOS 10.15 Catalina has deprecated the qlgenerator APIs. Moreover a .qlgenerator package inside Library/QuickLook must be notarized on 10.15.0 to works. In version 10.15.1 it seems that notarization is no longer required.
Fortunately, someone has bundled the QLColorCode into a Mac App for distribution.
Preview Source in Quick Look with Syntax Highlight
Syntax Highlight lets you easily customize the theme of the Quick Look preview with a few clicks. Before you can enable it in the System Preferences, you have to open the application to inform macOS that the app is available.
This application offers a quicklook extension for MacOS 10.15 Catalina for previewing source files. Inside it uses Highlight to render source code with syntax highlighting. The application is distributed with a version of the highlight. If you want you can use a different version customizing the preferences.
Open the Security & Privacy in the System Preferences and select Files and Folders under Privacy tab. Allow Syntax Highlight with the access to your folders.
Open Syntax Highlight again. Choose the theme for light and dark mode. I personally only use dark mode these days, so I selected Monokai as the theme and Input Mono as the font.
Syntax Highlight is not officially signed. Make sure you’re aware of the risks if you’re going to install it on your Mac. The project is open-source, so you can check the code yourself. I’m glad that we can enable this feature without tampering with each extension through terminal command.