macos-capabilities

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

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/RavitejaKarra24/dotfiles --skill macos-capabilities-ravitejakarra24
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: macos-capabilities
Source: https://github.com/RavitejaKarra24/dotfiles/tree/main/agents/.agents/skills/macos-development/macos-capabilities
Command: npx skills add https://github.com/RavitejaKarra24/dotfiles --skill macos-capabilities-ravitejakarra24

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Implementing macOS platform capabilities correctly is difficult: sandboxing rules, entitlements, extension lifecycles, and background execution APIs each have pitfalls that cause App Store rejections, crashes, or security issues. This Skill provides expert guidance and working code patterns for these system integration features. ## Core Features & Use Cases - Sandboxing & Entitlements: App Sandbox fundamentals, security-scoped bookmarks, file access patterns, and common rejection reasons. - Extensions & XPC: Share, Finder Sync, and Quick Look extensions, plus XPC services and App Groups for sharing data between app and extensions. - Menu Bar Apps: MenuBarExtra (SwiftUI) and NSStatusItem (AppKit) patterns, background-only app architecture, and popover management. - Background Operations: Login items via SMAppService, launch agents, BGTaskScheduler, file system monitoring, and sleep prevention. - Use Case: You are building a menu bar utility that must launch at login and persist access to a user-selected folder. The Skill provides the MenuBarExtra setup, SMAppService registration code, and security-scoped bookmark implementation with the required entitlements. ## Quick Start Ask the agent to help you implement a sandboxed macOS menu bar app that registers as a login item and persists folder access with security-scoped bookmarks.

Frequently Asked Questions about macos-capabilities

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

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

Use security-scoped bookmarks to persist access to user-selected files or folders across launches. Create bookmark data with the .withSecurityScope option, store it in UserDefaults, and resolve it later, always pairing startAccessingSecurityScopedResource with stopAccessingSecurityScopedResource.

How do I make a macOS app launch at login?

Use SMAppService from the ServiceManagement framework to register your app as a login item. Call SMAppService.mainApp.register() to enable and unregister() to disable, and check SMAppService.mainApp.status for the current state.

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

MenuBarExtra is the modern SwiftUI approach for macOS 13+ and requires less code, supporting both menu and window-style popovers. Use NSStatusItem when you need finer control such as distinguishing left and right clicks or custom badge rendering.

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 inbound connections. The App Sandbox blocks all network access by default, so these entitlements are required for any networking.

Why does my macOS app get rejected from the App Store for sandboxing?

Common rejection reasons include accessing files without user consent, missing network entitlements, writing outside the container, and using Apple Events without the automation entitlement. Use NSOpenPanel or security-scoped bookmarks and declare only the entitlements you need.

When should I use an XPC service instead of running code in my app?

Use XPC to isolate crash-prone or privileged work in a separate process with its own sandbox, share functionality between an app and its extensions, or run long tasks that should not crash the main app. Communication happens through an NSXPCConnection with a defined protocol.