Community코딩 & 개발github.com

macOS SwiftPM 앱 패키징

Xcode 프로젝트 없이 SwiftPM 기반 macOS 앱을 스캐폴딩, 빌드 및 패키징합니다. 처음부터 macOS 앱 레이아웃, SwiftPM 타겟/리소스, 사용자 정의 .app 번들 어셈블리 스크립트, 또는 Xcode 외부에서 서명/공증/앱캐스트 단계가 필요할 때 사용하세요.

macOS SwiftPM 앱 패키징란 무엇인가요?

이 스킬은 Xcode 프로젝트 없이 Swift Package Manager(SwiftPM)를 사용하여 macOS 애플리케이션을 처음부터 만들고, 빌드하고, 패키징하는 방법을 제공합니다. 이는 Xcode 사용이 불가능하거나 CI/CD 환경에서 자동화된 빌드 파이프라인을 구축해야 하는 개발자에게 매우 유용합니다. 이 스킬은 macOS 앱을 위한 기본 디렉토리 구조, SwiftPM 타겟 및 리소스 구성을 스캐폴딩하고, 사용자 정의 .app 번들을 어셈블하는 스크립트를 생성하며, Apple Developer Program을 통한 코드 서명 및 공증, Sparkle 프레임워크를 위한 앱캐스트 생성을 지원합니다. 주요 사용 사례는 기존 Xcode 중심 워크플로우를 대체하거나 보완하여, 더 가볍고 제어 가능한 macOS 앱 개발 환경을 구축하는 것입니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/dimillian/skills/tree/main/skills/macos-spm-app-packaging

Installed? Explore more 코딩 & 개발 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

macOS SwiftPM 앱 패키징은(는) 무엇을 하나요?

Xcode 프로젝트 없이 SwiftPM 기반 macOS 앱을 스캐폴딩, 빌드 및 패키징합니다. 처음부터 macOS 앱 레이아웃, SwiftPM 타겟/리소스, 사용자 정의 .app 번들 어셈블리 스크립트, 또는 Xcode 외부에서 서명/공증/앱캐스트 단계가 필요할 때 사용하세요.


개요

이 스킬은 Swift Package Manager(SwiftPM)를 사용하여 macOS 애플리케이션을 빌드하고 배포하기 위한 완전한 워크플로우를 제공합니다. Xcode 프로젝트가 필요 없으므로 CI/CD 환경에 적합하며, 앱 번들 생성부터 서명 및 공증까지 모든 단계를 제어할 수 있습니다.

주요 기능

  • 프로젝트 스캐폴딩: SwiftPM 기반 macOS 앱을 위한 표준 디렉토리 구조와 기본 파일 생성
  • SwiftPM 타겟 구성: 앱 타겟과 리소스 정의
  • 사용자 정의 번들 스크립트: .app 번들을 수동으로 어셈블하는 package.sh 스크립트 생성
  • 서명 및 공증: Apple Developer Program 인증서로 앱 서명 및 Apple公证 서비스 제출
  • 앱캐스트 생성: Sparkle 업데이트 프레임워크를 위한 appcast.xml 생성

시작하기

전제 조건

  • SwiftPM이 설치된 macOS 시스템 (swift --version으로 확인)
  • Apple Developer Program 계정 (서명 및 공증에 필요 시)
  • create-dmg (선택 사항, DMG 생성을 위해 brew install create-dmg)

사용법

  1. 프로젝트 스캐폴딩
# 새 macOS 앱 프로젝트 생성
swift package init --name MyApp --type executable
  1. 앱 레이아웃 설정

디렉토리 구조를 다음과 같이 구성하세요:

MyApp/
├── Sources/
│   └── MyApp/
│       └── main.swift
├── Resources/
│   ├── Assets.xcassets/
│   └── Info.plist
├── Package.swift
└── package.sh
  1. Package.swift 예시
// swift-tools-version:5.5
import PackageDescription

let package = Package(
    name: "MyApp",
    platforms: [.macOS(.v11)],
    targets: [
        .executableTarget(
            name: "MyApp",
            resources: [.process("Resources")]
        )
    ]
)
  1. 번들 어셈블리 스크립트 (package.sh)

아래 스크립트는 .app 번들을 빌드하고 패키징합니다:

#!/bin/bash
# package.sh - SwiftPM macOS 앱 번들 패키징

APP_NAME="MyApp"
BUILD_DIR=".build"
APP_BUNDLE="$APP_NAME.app"
CONTENTS_DIR="$APP_BUNDLE/Contents"
MACOS_DIR="$CONTENTS_DIR/MacOS"
RESOURCES_DIR="$CONTENTS_DIR/Resources"

# SwiftPM 릴리스 빌드 수행
swift build -c release

# .app 번들 디렉토리 생성
mkdir -p "$MACOS_DIR"
mkdir -p "$RESOURCES_DIR"

# 실행 파일 복사
cp "$BUILD_DIR/release/$APP_NAME" "$MACOS_DIR/"

# 리소스 복사 (예: Info.plist)
cp "Sources/$APP_NAME/Info.plist" "$CONTENTS_DIR/"

# 앱 서명 (개발자 ID가 있는 경우)
# codesign --deep --force --verify --verbose --sign "Developer ID Application: Your Name" "$APP_BUNDLE"

echo "앱 번들 생성 완료: $APP_BUNDLE"

고급 설정

서명 및 공증

앱을 배포하려면 Apple 공증 서비스를 통과해야 합니다:

# 서명
codesign --deep --force --verify --verbose --sign "Developer ID Application: Your Name" "MyApp.app"

# 공증 제출
xcrun notarytool submit "MyApp.app" --apple-id "[email protected]" --team-id "TEAMID" --password "@keychain:AC_PASSWORD" --wait

# 공증 확인 (스테이플링)
xcrun stapler staple "MyApp.app"

앱캐스트 생성

Sparkle 업데이트를 위한 앱캐스트 XML:

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
    <channel>
        <title>MyApp Changelog</title>
        <item>
            <title>Version 1.0</title>
            <sparkle:version>1.0</sparkle:version>
            <sparkle:shortVersionString>1.0</sparkle:shortVersionString>
            <enclosure url="https://example.com/MyApp-1.0.dmg" length="12345678" type="application/octet-stream" sparkle:dsaSignature="..." />
        </item>
    </channel>
</rss>

지원 플랫폼

플랫폼지원참고
macOS✅기본 플랫폼
CI/CD (GitHub Actions, CircleCI)✅Xcode 필요 없음
로컬 개발✅SwiftPM만 있으면 됨

문제 해결

  • 빌드 오류: swift build -c release가 실패하면 Package.swift 구문을 확인하세요.
  • 서명 오류: 개발자 ID 인증서가 키체인에 올바르게 설치되었는지 확인하세요.
  • 공증 실패: 앱이 샌드박스 요구 사항을 충족하는지 확인하세요.

참고 링크

Individual skills in this repo

This repo contains 7 individual skills — each has its own dedicated page.

dimillian/app-store-changelog

Create user-facing App Store release notes by collecting and summarizing all user-impacting changes since the last git tag (or a specified ref). Use when asked to generate a comprehensive release changelog, App Store "What's New" text, or release notes based on git history or tags.

dimillian/ios-debugger-agent

Use XcodeBuildMCP to build, run, launch, and debug the current iOS project on a booted simulator. Trigger when asked to run an iOS app, interact with the simulator UI, inspect on-screen state, capture logs/console output, or diagnose runtime behavior using XcodeBuildMCP tools.

dimillian/swift-concurrency-expert

Swift Concurrency review and remediation for Swift 6.2+. Use when asked to review Swift Concurrency usage, improve concurrency compliance, or fix Swift concurrency compiler errors in a feature or file. Concrete actions include adding Sendable conformance, applying @MainActor annotations, resolving actor isolation warnings, fixing data race diagnostics, and migrating completion handlers to async/await.

dimillian/swiftui-liquid-glass

Implement, review, or improve SwiftUI features using the iOS 26+ Liquid Glass API. Use when asked to adopt Liquid Glass in new SwiftUI UI, refactor an existing feature to Liquid Glass, or review Liquid Glass usage for correctness, performance, and design alignment.

dimillian/swiftui-performance-audit

Audit and improve SwiftUI runtime performance from code review and architecture. Use for requests to diagnose slow rendering, janky scrolling, high CPU/memory usage, excessive view updates, or layout thrash in SwiftUI apps, and to provide guidance for user-run Instruments profiling when code review alone is insufficient.

dimillian/swiftui-ui-patterns

Best practices and example-driven guidance for building SwiftUI views and components, including navigation hierarchies, custom view modifiers, and responsive layouts with stacks and grids. Use when creating or refactoring SwiftUI UI, designing tab architecture with TabView, composing screens with VStack/HStack, managing @State or @Binding, building declarative iOS interfaces, or needing component-specific patterns and examples.

dimillian/swiftui-view-refactor

Refactor and review SwiftUI view files with strong defaults for small dedicated subviews, MV-over-MVVM data flow, stable view trees, explicit dependency injection, and correct Observation usage. Use when cleaning up a SwiftUI view, splitting long bodies, removing inline actions or side effects, reducing computed `some View` helpers, or standardizing `@Observable` and view model initialization patterns.

관련 스킬