jpskill.com
🛠️ 開発・MCP コミュニティ

macos-developer

macOSアプリ開発の専門家として、AppKitやSwiftUI、XPCを用いたシステム拡張やメニューバーアプリを開発するSkill。

📜 元の英語説明(参考)

Expert in macOS app development using AppKit, SwiftUI for Mac, and XPC. Specializes in system extensions, menu bar apps, and deep OS integration.

🇯🇵 日本人クリエイター向け解説

一言でいうと

macOSアプリ開発の専門家として、AppKitやSwiftUI、XPCを用いたシステム拡張やメニューバーアプリを開発するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o macos-developer.zip https://jpskill.com/download/6690.zip && unzip -o macos-developer.zip && rm macos-developer.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/6690.zip -OutFile "$d\macos-developer.zip"; Expand-Archive "$d\macos-developer.zip" -DestinationPath $d -Force; ri "$d\macos-developer.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して macos-developer.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → macos-developer フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-17
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

macOS 開発者

目的

AppKit、Mac 用 SwiftUI、およびシステム統合に特化した、ネイティブ macOS アプリケーション開発の専門知識を提供します。XPC サービス、メニューバーアプリ、および Apple エコシステム向けの深い OS 機能を使用して、ネイティブデスクトップアプリケーションを構築します。

使用する場面

  • ネイティブ macOS アプリ (DMG/App Store) の構築
  • メニューバーアプリ (NSStatusItem) の開発
  • 権限分離のための XPC サービスの実装
  • システム拡張機能 (Endpoint Security, Network Extension) の作成
  • iPad アプリの Mac への移植 (Catalyst)
  • Mac 管理タスクの自動化 (AppleScript/JXA)


2. 意思決定フレームワーク

UI フレームワーク

フレームワーク 最適な用途 利点 欠点
SwiftUI モダンなアプリ 宣言的でシンプルなコード。 AppKit の機能との同等性が限られています。
AppKit システムツール 完全な制御 (NSWindow, NSView)。 命令的で冗長です。
Catalyst iPad ポート iPad コードから Mac アプリを無料で作成できます。 iPad アプリのように見えます。

配布チャネル

  • Mac App Store: サンドボックス化され、検証済みで、更新が簡単です。(システム拡張機能に必須です)。
  • 直接配布 (DMG): 公証が必要です。より自由度が高いです (アクセシビリティ API、フルディスクアクセス)。

プロセスアーキテクチャ

  • モノリス: シンプルなアプリ。
  • XPC サービス: 複雑なアプリ。クラッシュを分離し、権限昇格を可能にします (ヘルパーツール)。

危険信号 → security-engineer にエスカレートしてください:

  • 正当な理由なく「フルディスクアクセス」を要求する
  • バイナリに秘密鍵を埋め込む
  • Gatekeeper/公証をバイパスする


3. コアワークフロー

ワークフロー 1: メニューバーアプリ (SwiftUI)

目標: メニューバーに常駐するアプリを作成します。

手順:

  1. アプリのセットアップ

    @main
    struct MenuBarApp: App {
        var body: some Scene {
            MenuBarExtra("Utility", systemImage: "hammer") {
                Button("Action") { doWork() }
                Divider()
                Button("Quit") { NSApplication.shared.terminate(nil) }
            }
        }
    }
  2. Dock アイコンを非表示にする

    • Info.plist: LSUIElement = YES


ワークフロー 3: システム拡張機能 (Endpoint Security)

目標: ファイルイベントを監視します。

手順:

  1. エンタイトルメント

    • com.apple.developer.endpoint-security.client = YES
  2. 実装 (C API)

    es_client_t *client;
    es_new_client(&client, ^(es_client_t *c, const es_message_t *msg) {
        if (msg->event_type == ES_EVENT_TYPE_NOTIFY_EXEC) {
            // Log process execution
        }
    });


5. アンチパターンと落とし穴

❌ アンチパターン 1: iOS の動作を前提とする

どのようなものか:

  • シンプルなウィンドウが必要な場合に NavigationView (分割ビュー) を使用する。
  • メニューバーコマンド (Cmd+QCmd+S) を無視する。

なぜ失敗するのか:

  • Mac では異質な感じがします。

正しいアプローチ:

  • キーボードショートカットをサポートします。
  • マルチウィンドウワークフローをサポートします。

❌ アンチパターン 2: メインスレッドをブロックする

どのようなものか:

  • メインスレッドでファイル I/O を実行する。

なぜ失敗するのか:

  • スピニングビーチボールオブデス (SPOD) が発生します。

正しいアプローチ:

  • DispatchQueue.global() または Swift の Task を使用します。


例 1: プロフェッショナルなメニューバーアプリケーション

シナリオ: macOS のメニューバーに常駐し、素早くアクセスできるシステムユーティリティを構築します。

開発アプローチ:

  1. プロジェクト設定: MenuBarExtra を使用した SwiftUI
  2. ウィンドウ管理: ポップアップメニュー付きの非表示ドックアイコン
  3. 設定統合: 環境設定のための UserDefaults
  4. ステータス項目: アイコンとメニュー付きのカスタム NSStatusItem

実装:

@main
struct SystemUtilityApp: App {
    var body: some Scene {
        MenuBarExtra("System Utility", systemImage: "gear") {
            VStack(spacing: 12) {
                Button("Open Preferences") { openPreferences() }
                Button("Check Updates") { checkForUpdates() }
                Divider()
                Button("Quit") { NSApplication.shared.terminate(nil) }
            }
            .padding()
            .frame(width: 200)
        }
    }
}

主な機能:

  • Dock アイコンを非表示にするための Info.plist の LSUIElement
  • クイックアクションのためのキーボードショートカット
  • メニュー更新を伴うバックグラウンド更新
  • 自動更新のための Sparkle

結果:

  • Mac App Store で 4.8 つ星の評価でリリース
  • 50,000 人以上のアクティブユーザー
  • 「ベスト新着アプリ」カテゴリで特集

例 2: XPC サービスを使用したドキュメントベースのアプリケーション

シナリオ: バックグラウンド処理を備えたプロフェッショナルなドキュメントエディタを構築します。

アーキテクチャ:

  1. メインアプリ: SwiftUI ドキュメント処理
  2. XPC サービス: バックグラウンドドキュメント処理
  3. サンドボックス: 適切なアプリサンドボックス構成
  4. IPC: 通信のための NSXPCConnection

XPC サービスの実装:

// Service Protocol
@objc protocol ProcessingServiceProtocol {
    func processDocument(at url: URL, reply: @escaping (URL?) -> Void)
}

// Service Implementation
class ProcessingService: NSObject, ProcessingServiceProtocol {
    func processDocument(at url: URL, reply: @escaping (URL?) -> Void) {
        // Heavy processing in separate process
        let result = heavyProcessing(url: url)
        reply(result)
    }
}

利点:

  • クラッシュ分離 (サービスがクラッシュしてもアプリは終了しません)
  • メモリフットプリントの削減
  • 機密操作のための権限分離
  • App Store 承認の可能性の向上

例 3: ネットワーク監視のためのシステム拡張機能

シナリオ: システム拡張機能を使用してネットワーク監視ツールを作成します。

開発プロセス:

  1. エンタイトルメント構成: エンドポイントセキュリティエンタイトルメント
  2. システム拡張機能: ネットワーク拡張機能の実装
  3. デプロイ: 適切な公証と署名
  4. ユーザー承認: システム拡張機能承認ワークフロー

実装:

// Network extension handler
class NetworkExtensionHandler: NEProvider {
    override func startProtocol(options: [String: Any]?, completionHandler: @escaping (Error?) -> Void) {
        // Start network monitoring
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

macOS Developer

Purpose

Provides native macOS application development expertise specializing in AppKit, SwiftUI for Mac, and system integration. Builds native desktop applications with XPC services, menu bar apps, and deep OS capabilities for the Apple ecosystem.

When to Use

  • Building native macOS apps (DMG/App Store)
  • Developing Menu Bar apps (NSStatusItem)
  • Implementing XPC Services for privilege separation
  • Creating System Extensions (Endpoint Security, Network Extension)
  • Porting iPad apps to Mac (Catalyst)
  • Automating Mac admin tasks (AppleScript/JXA)


2. Decision Framework

UI Framework

Framework Best For Pros Cons
SwiftUI Modern Apps Declarative, simple code. Limited AppKit feature parity.
AppKit System Tools Full control (NSWindow, NSView). Imperative, verbose.
Catalyst iPad Ports Free Mac app from iPad code. Looks like an iPad app.

Distribution Channel

  • Mac App Store: Sandboxed, verified, easy updates. (Required for System Extensions).
  • Direct Distribution (DMG): Notarization required. More freedom (Accessibility API, Full Disk Access).

Process Architecture

  • Monolith: Simple apps.
  • XPC Service: Complex apps. Isolates crashes, allows privilege escalation (Helper tool).

Red Flags → Escalate to security-engineer:

  • Requesting "Full Disk Access" without a valid reason
  • Embedding private keys in the binary
  • Bypassing Gatekeeper/Notarization


3. Core Workflows

Workflow 1: Menu Bar App (SwiftUI)

Goal: Create an app that lives in the menu bar.

Steps:

  1. App Setup

    @main
    struct MenuBarApp: App {
        var body: some Scene {
            MenuBarExtra("Utility", systemImage: "hammer") {
                Button("Action") { doWork() }
                Divider()
                Button("Quit") { NSApplication.shared.terminate(nil) }
            }
        }
    }
  2. Hide Dock Icon

    • Info.plist: LSUIElement = YES.


Workflow 3: System Extension (Endpoint Security)

Goal: Monitor file events.

Steps:

  1. Entitlements

    • com.apple.developer.endpoint-security.client = YES.
  2. Implementation (C API)

    es_client_t *client;
    es_new_client(&client, ^(es_client_t *c, const es_message_t *msg) {
        if (msg->event_type == ES_EVENT_TYPE_NOTIFY_EXEC) {
            // Log process execution
        }
    });


5. Anti-Patterns & Gotchas

❌ Anti-Pattern 1: Assuming iOS Behavior

What it looks like:

  • Using NavigationView (split view) when a simple Window is needed.
  • Ignoring Menu Bar commands (Cmd+Q, Cmd+S).

Why it fails:

  • Feels alien on Mac.

Correct approach:

  • Support Keyboard Shortcuts.
  • Support Multi-Window workflows.

❌ Anti-Pattern 2: Blocking Main Thread

What it looks like:

  • Running file I/O on main thread.

Why it fails:

  • Spinning Beach Ball of Death (SPOD).

Correct approach:

  • Use DispatchQueue.global() or Swift Task.


Examples

Example 1: Professional Menu Bar Application

Scenario: Build a system utility that lives in the macOS menu bar for quick access.

Development Approach:

  1. Project Setup: SwiftUI with MenuBarExtra
  2. Window Management: Hidden dock icon with popup menu
  3. Settings Integration: UserDefaults for preferences
  4. Status Item: Custom NSStatusItem with icon and menu

Implementation:

@main
struct SystemUtilityApp: App {
    var body: some Scene {
        MenuBarExtra("System Utility", systemImage: "gear") {
            VStack(spacing: 12) {
                Button("Open Preferences") { openPreferences() }
                Button("Check Updates") { checkForUpdates() }
                Divider()
                Button("Quit") { NSApplication.shared.terminate(nil) }
            }
            .padding()
            .frame(width: 200)
        }
    }
}

Key Features:

  • LSUIElement in Info.plist to hide dock icon
  • Keyboard shortcuts for quick actions
  • Background refresh with menu updates
  • Sparkle for automatic updates

Results:

  • Released on Mac App Store with 4.8-star rating
  • 50,000+ active users
  • Featured in "Best New Apps" category

Example 2: Document-Based Application with XPC Services

Scenario: Build a professional document editor with background processing.

Architecture:

  1. Main App: SwiftUI document handling
  2. XPC Service: Background document processing
  3. Sandbox: Proper app sandbox configuration
  4. IPC: NSXPCConnection for communication

XPC Service Implementation:

// Service Protocol
@objc protocol ProcessingServiceProtocol {
    func processDocument(at url: URL, reply: @escaping (URL?) -> Void)
}

// Service Implementation
class ProcessingService: NSObject, ProcessingServiceProtocol {
    func processDocument(at url: URL, reply: @escaping (URL?) -> Void) {
        // Heavy processing in separate process
        let result = heavyProcessing(url: url)
        reply(result)
    }
}

Benefits:

  • Crash isolation (service crash doesn't kill app)
  • Reduced memory footprint
  • Privilege separation for sensitive operations
  • Better App Store approval chances

Example 3: System Extension for Network Monitoring

Scenario: Create a network monitoring tool using System Extension.

Development Process:

  1. Entitlement Configuration: Endpoint security entitlement
  2. System Extension: Network extension implementation
  3. Deployment: Proper notarization and signing
  4. User Approval: System extension approval workflow

Implementation:

// Network extension handler
class NetworkExtensionHandler: NEProvider {
    override func startProtocol(options: [String: Any]?, completionHandler: @escaping (Error?) -> Void) {
        // Start network monitoring
        setupNetworkMonitoring()
        completionHandler(nil)
    }

    override func stopProtocol(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) {
        // Clean up resources
        stopNetworkMonitoring()
        completionHandler()
    }
}

Requirements:

  • Notarization for distribution outside App Store
  • User-approved system extension
  • Proper entitlements from Apple Developer portal

Best Practices

AppKit and SwiftUI Integration

  • Hybrid Approach: Use SwiftUI for UI, AppKit for complex components
  • NSViewRepresentable: Wrap NSView for SwiftUI use
  • NSHostingView: Embed SwiftUI in AppKit windows
  • Data Flow: Use Observable or StateObject for shared state

Sandboxing and Security

  • Minimal Entitlements: Request only necessary permissions
  • Keychain: Use Keychain for sensitive data storage
  • App Sandbox: Enable for App Store distribution
  • Hardened Runtime: Required for notarization

Distribution and Deployment

  • Code Signing: Always sign before notarization
  • Notarization: Submit to Apple for security validation
  • Auto-Updates: Implement Sparkle for direct distribution
  • DMG Creation: Use create-dmg or similar tools

Performance Optimization

  • Lazy Loading: Defer resource loading until needed
  • Background Tasks: Use BGTaskScheduler for long operations
  • Memory Management: Monitor memory pressure
  • Startup Time: Optimize launch sequence

User Experience

  • Keyboard Navigation: Support full keyboard operation
  • Dark Mode: Properly handle light and dark appearances
  • Accessibility: VoiceOver compatibility from start
  • Window Management: Support multiple windows properly

Quality Checklist

UX:

  • [ ] Menus: App supports standard menu commands.
  • [ ] Windows: Resizable, supports Full Screen.
  • [ ] Dark Mode: Supports System Appearance.
  • [ ] Accessibility: VoiceOver works on key elements.

System:

  • [ ] Sandboxing: App Sandbox enabled (if App Store).
  • [ ] Hardened Runtime: Enabled for Notarization.
  • [ ] Code Signing: Properly signed for distribution.
  • [ ] Notarization: Submitted and approved by Apple.

Performance:

  • [ ] Startup: App launches within 5 seconds.
  • [ ] Memory: No memory leaks or excessive usage.
  • [ ] Responsive: UI remains responsive during operations.