I’ve used clipboard managers on the Mac for about a decade, and they all stop in the same place: they remember everything and do nothing with it. I’d copy a minified JSON blob and paste it into an editor just to format it. Copy a variable name and retype it in snake_case. Copy a screenshot of an error and go hunting for an OCR tool. The history was never the bottleneck. The round trip to another app was.
So I built ClipMason, a clipboard manager that acts on what you copy instead of just storing it. The features aren’t the interesting part for this crowd, though. The interesting part was staying inside the Mac App Store sandbox, because most of the well-known managers ship outside it or lean on the Accessibility API. I wanted to know what you can actually do without either.
Here are the notes.
What works fine in the sandbox
NSPasteboard monitoring. There is no notification API for the pasteboard, so it is a 0.5s Timer polling changeCount. Idle cost is negligible; I measured it before shipping and it never showed up.
Global hotkeys via Carbon RegisterEventHotKey (⌘⇧V). No Input Monitoring prompt, no Accessibility prompt. This surprised me. A lot of people assume a global shortcut forces you out of the sandbox, and it doesn’t.
Vision for OCR. VNRecognizeTextRequest with .accurate is a system framework, works entitlement-free, and it was good enough that I never bothered writing a fallback.
SwiftData for storage, with @Attribute(.externalStorage) on the image blobs so the database doesn’t balloon.
MenuBarExtra plus a Window scene plus a Settings scene, with LSUIElement = true so there is no Dock icon.
NSWorkspace.frontmostApplication for attributing each clip to the app it came from.
What doesn’t
Auto-paste into the frontmost app. That needs the Accessibility API (AXUIElement) or posting CGEvents into another process. Both are out in the sandbox. So ⌘⇧V puts the clip on the pasteboard and you press ⌘V yourself. This is the one real UX cost, and I would rather say it plainly than pretend it isn’t there. If auto-paste is a dealbreaker for you, an Accessibility-based manager is the right call.
Reading other apps’ state beyond what NSWorkspace exposes. Not available, by design.
The privacy bit worth stealing
org.nspasteboard.ConcealedType is a community convention, not an Apple API. Password managers set it on the pasteboard when they copy a secret. Checking for it is three lines and means passwords never enter your history:
let concealed = NSPasteboard.PasteboardType(rawValue: "org.nspasteboard.ConcealedType")
if pasteboard.data(forType: concealed) != nil { return }
Enter fullscreen mode Exit fullscreen mode
If you are building anything that touches NSPasteboard, please implement this. It is the difference between a clipboard history and a password leak.
Architecture
Roughly: models (SwiftData) / services (ClipboardMonitor, HotkeyManager, OCRService, SmartTagDetector, PrivacyManager) / views split by surface (menu bar, popup, main window, actions, settings).
The one decision that paid off: actions are enums with an execute(_:) method. TextAction has 23 cases (case conversions, URL/Base64, JSON pretty-print and minify, hashes, line ops, counts), ImageAction has 14 (OCR, rotate, flip, resize, annotate, export). Adding a transformation is one case, and localization falls out of the enum almost for free.
About 4,700 lines of Swift, a 2.9 MB shipped binary, 17 languages through String Catalogs, and no network code at all. Grep the binary for URLSession and you get nothing, which is exactly what a clipboard manager should be.
If you want to see it
ClipMason is on the Mac App Store for $6.99, one time, no subscription. macOS 14+.
Mostly, though, I am curious what other sandbox edges people have run into. If you have shipped something that had to stay inside the App Store and found a workaround, or a wall, I would like to hear it.
답글 남기기