跳到正文
DEV Community· int21·· 3 小時前AI 評分50

macOS 開發者每週可節省數小時的 QuickLook 擴充功能

QuickLook Extensions That Save macOS Developers Hours Every Week

AI 導讀

QuickLook 擴充功能可在 Finder 中預覽檔案,讓 macOS 開發者無須開啟應用程式便能檢查多種檔案格式。免費的 OmniPreview 支援程式碼、壓縮檔、基建設定檔、ML 檔案、圖片及字型;Pro 版另提供 ML 模型檢視、壓縮檔瀏覽及自訂檔案類型規則。作者表示,擴充功能本身為開源,並可透過 Mac App Store 免費取得。

正文

QuickLook Extensions That Save macOS Developers Hours Every Week

If you work on a Mac, you know the drag-and-drop frustration: open Finder, drag a file to an app, get "Unsupported file type" — repeat with ten more files.

The QuickLook API, introduced in macOS Big Sur, solves this silently. A QuickLook extension previews files in the Finder before you even open them. No app launching. No "what was that format again?"

Here are extensions I find essential for development workflows:

The PDF & Archive Problem

Developers work with PDFs, ZIP files, PKGs, DMGs, XAR archives, and ML model files (.mlmodel, .onnx, .tflite). macOS shows a generic icon for most of these. You click, the app opens, the app says "I can't open that," you close it.

A QuickLook extension previews these in the Finder. You can spot-check a configuration file in a PKG, inspect an archive's contents, or verify an ML model's metadata — without opening anything.

What QuickLook Extensions Actually Do

QuickLook extensions register file types they understand. When you press the Space key on a file in Finder, macOS asks all registered extensions if they can handle it. If one says yes, it renders a preview.

The API surface is small:

  • providePreview(for:withHandler:) — main entry point
  • icon(for:withHandler:) — custom icon (optional)
  • fileWrapper(for:withHandler:completionHandler:) — optional file export

No UI. No windows. A single render method and a context object telling you the file URL and desired size.

OmniPreview: One Extension, Many Formats

OmniPreview is a free QuickLook extension with a Pro upgrade. It supports:

  • Developer files: source code (any language), JSON, XML, YAML, Markdown, HTML, CSV, SQL
  • Archives: ZIP, TAR, GZ, BZ2, XZ, 7Z, RAR, PKG, DMG, XAR
  • Infrastructure: Terraform, Dockerfiles, Kubernetes YAML, Vagrantfiles, Ansible playbooks
  • ML files: Core ML (.mlmodel), ONNX, TensorFlow SavedModel directories
  • Image formats: SVG, GIF, animated WebP, HEIC, HEIF, Raw camera formats
  • Fonts: OTF, TTF, WOFF, WOFF2

The free tier covers the essentials. Pro adds ML model inspection, archive navigation, and custom file type rules.

Why This Matters

Let's say you download a package of configuration files. Before spending 30 minutes setting up your environment, you can preview 20 files in the Finder and spot the missing pieces. Or a ML practitioner downloads a model from Hugging Face — check its architecture and metadata instantly without loading a GPU.

The time saved compounds across hundreds of files per week.

Getting Started

QuickLook extensions live in ~/Library/QuickLook/. Installation is usually a single copy command or a drag-and-drop into that folder. No sandbox permission dialogs. No background processes.

For developers who touch dozens of file types daily, QuickLook extensions are the invisible tool that makes the Mac feel faster.


Disclosure: I built OmniPreview. It's free on the Mac App Store and also available as a Gumroad version (€5+, pay-what-you-want) with source code included. The extension itself is open source.

來源:DEV Community · dev.to