Command Palette

Search for a command to run...

Назад к скиллам
скилл № 18028

macos-spm-app-packaging

Turns a Swift Package Manager executable into a real macOS .app without an Xcode project: builds the binary, assembles the bundle and Info.plist, signs it…

БесплатноБез исполняемых скриптов
TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Установить macos-spm-app-packaging в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

macOS SwiftPM App Packaging

Overview

swift build produces a bare executable. macOS treats a program as an app only when that executable sits inside a bundle: a folder ending in .app with a fixed layout, an Info.plist that names the executable and the bundle identifier, and a code signature that seals both. Xcode normally creates all of that; with a SwiftPM-only project a script has to. This skill gives the layout, the script, the signing rules and the notarization sequence, with a check after every stage so a failure is caught where it happens instead of on a user's Mac.

Instructions

1. Establish the facts

Ask the user:

  • Who runs the result: only this Mac, a few testers, or the public? That decides the signing level (step 5).
  • Bundle identifier, display name, marketing version and build number.
  • The oldest macOS to support, and whether Intel Macs matter (universal binary).
  • Is it a menu bar agent with no Dock icon?
  • For public distribution: the Developer ID identity and the name of the stored notary profile. The Mac App Store is out of scope; it needs an Xcode archive and an installer package.

Read from the project: Package.swift (the executable target name, platforms, resources, dependencies that ship frameworks), swift --version, existing scripts under Scripts/, and the installed signing identities:

security find-identity -p codesigning -v     # lists identity names and SHA-1 hashes, no private keys

2. Build the executable

swift build --configuration release --product Skiff
swift build --configuration release --show-bin-path      # prints the folder that holds Skiff

For a universal binary, build each architecture and merge:

swift build --configuration release --product Skiff --triple arm64-apple-macosx
swift build --configuration release --product Skiff --triple x86_64-apple-macosx
lipo -create -output build/Skiff-universal \
  "$(swift build --configuration release --triple arm64-apple-macosx --show-bin-path)/Skiff" \
  "$(swift build --configuration release --triple x86_64-apple-macosx --show-bin-path)/Skiff"
lipo -archs build/Skiff-universal                        # x86_64 arm64

3. Assemble the bundle

Skiff.app/
└── Contents/
    ├── Info.plist              # required; identifies the bundle
    ├── MacOS/Skiff             # the executable, same name as CFBundleExecutable
    ├── Resources/              # icon, images, data files; everything that is not code
    └── Frameworks/             # embedded frameworks and dylibs, only if the app ships any

Placement matters for signing: Mach-O code goes in MacOS/ or Frameworks/, data goes in Resources/. A data file left in MacOS/, or anything at all in the bundle's top level beside Contents/, breaks the signature or slows notarization. Copy with ditto, which preserves the symlinks that frameworks depend on.

Minimum Info.plist keys:

Key Value for the example Purpose
CFBundleExecutable Skiff File name inside Contents/MacOS
CFBundleIdentifier dev.pinecrest.Skiff Unique reverse-DNS identifier
CFBundleName Skiff Short user-visible name
CFBundlePackageType APPL Marks an application bundle
CFBundleShortVersionString 1.4.0 Version users see
CFBundleVersion 37 Build number; raise it on every release
LSMinimumSystemVersion 14.0 Must match platforms in Package.swift
CFBundleIconFile AppIcon AppIcon.icns in Resources/
NSPrincipalClass NSApplication Main class for a Cocoa app
NSHighResolutionCapable true Retina rendering
LSUIElement true, menu bar agents only No Dock icon

Icon. Put PNGs named icon_16x16.png through [email protected] in AppIcon.iconset, then iconutil -c icns AppIcon.iconset -o Resources/AppIcon.icns.

Resources. Files the app target owns are simplest to keep in a plain Resources/ folder at the repository root, copy into Contents/Resources/, and load with Bundle.main. Resource bundles that SwiftPM generates for dependencies (*.bundle folders in the bin path) also go into Contents/Resources/; launch the assembled app and exercise a feature that reads them, because where Bundle.module looks has changed between toolchains.

Embedded frameworks. Copy each into Contents/Frameworks/ and make sure the executable has the run path @executable_path/../Frameworks.

4. Check the bundle before signing

plutil -lint build/Skiff.app/Contents/Info.plist       # OK
file build/Skiff.app/Contents/MacOS/Skiff              # Mach-O ... executable
lipo -archs build/Skiff.app/Contents/MacOS/Skiff       # the architectures you intended

5. Sign

Audience Identity Command options
This Mac, development loop Ad hoc (-) codesign --force --sign - Skiff.app
Other
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • _scores.json

FAQ

Что делает скилл macos-spm-app-packaging?

Turns a Swift Package Manager executable into a real macOS .app without an Xcode project: builds the binary, assembles the bundle and Info.plist, signs it, and for distribution notarizes, staples and wraps it in a zip or disk image. Covers universal binaries, resources and icons, hardened runtime entitlements, reading the notary log, and Sparkle update feeds. Use when the user says "package my SwiftPM app", "make an .app from swift build", "no Xcode project", "sign and notarize", "Gatekeeper says the app is damaged", "notarization failed", "make a universal binary" or "ship a DMG".

Как установить скилл macos-spm-app-packaging?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл macos-spm-app-packaging запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить macos-spm-app-packaging с