macos-capabilities

Guides implementation of macOS sandboxing, extensions, menu bar apps, and background execution.

70|4|Updated Jul 22, 2025
One-click install
npx skills add https://github.com/AlexW00/Zettel --skill macos-capabilities-alexw00
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: macos-capabilities
Source: https://github.com/AlexW00/Zettel/tree/main/.agents/skills/macos-development/macos-capabilities
Command: npx skills add https://github.com/AlexW00/Zettel --skill macos-capabilities-alexw00

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Implementing macOS platform capabilities correctly is difficult: sandboxing rules, entitlements, security-scoped bookmarks, and extension lifecycles are easy to get wrong, leading to App Store rejections, crashes, or security issues. This Skill provides expert guidance and working code patterns for macOS system integration. ## Core Features & Use Cases - Sandboxing & Entitlements: Configure App Sandbox, security-scoped bookmarks, and file access patterns that pass Mac App Store review. - Extensions & XPC: Build Share, Finder Sync, and Quick Look extensions plus XPC services for crash isolation and privilege separation. - Menu Bar Apps: Create menu bar utilities with MenuBarExtra or NSStatusItem, including background-only apps with LSUIElement. - Background Operations: Register login items via ServiceManagement, schedule background tasks, and monitor file system changes. - Use Case: You are building a note-taking utility that must launch at login, live in the menu bar, and persist access to a user-selected notes folder. This Skill walks you through the SMAppService registration, MenuBarExtra setup, and security-scoped bookmark code with the exact entitlements required. ## Quick Start Ask the assistant to help you add a launch-at-login toggle and sandbox-compliant folder access to your macOS app.

Frequently Asked Questions about macos-capabilities

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I make a macOS app launch at login?▼

Use the ServiceManagement framework's SMAppService.mainApp.register() on macOS 13 and later. Check SMAppService.mainApp.status to handle the requiresApproval state, and avoid the deprecated SMLoginItemSetEnabled API.

How do I persist file access in a sandboxed macOS app?▼

Use security-scoped bookmarks: create bookmark data with the .withSecurityScope option after the user selects a file or folder via NSOpenPanel, then resolve it on later launches. Always balance startAccessingSecurityScopedResource with stopAccessingSecurityScopedResource, typically via defer.

Should I use MenuBarExtra or NSStatusItem for a menu bar app?▼

MenuBarExtra is the modern SwiftUI approach for macOS 13+ and requires far less code, with .menuBarExtraStyle(.window) for rich popover UIs. Use NSStatusItem from AppKit when you need fine-grained control such as distinguishing left and right mouse clicks.

What entitlements does a sandboxed macOS app need for network access?▼

Add com.apple.security.network.client for outbound connections and com.apple.security.network.server for accepting inbound connections. Without these entitlements the sandbox blocks all network activity, which is a common cause of App Store rejection.

When should I use an XPC service in my macOS app?▼

Use XPC services to isolate crash-prone code like parsing untrusted data, run privileged operations separately, or share functionality between an app and its extensions. The XPC service runs in its own process with its own sandbox, communicating through an NSXPCConnection protocol.

Why does my sandboxed app lose access to files after restart?▼

User-selected file access granted via NSOpenPanel lasts only for the current session. To persist access across launches you must save a security-scoped bookmark and re-resolve it, with the com.apple.security.files.bookmarks.app-scope entitlement enabled.