[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-99ffd416-fa1d-4675-af68-faff4c041770":3,"$fDxfrDMh2xAbJiiDe0_awwbKTahK5xEHbITw1689H1lk":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"99ffd416-fa1d-4675-af68-faff4c041770","macos-spm-app-packaging","脚手架、构建、签名和打包SwiftPM macOS应用，无需Xcode项目。","cat_coding_frontend","mod_coding","sickn33,coding","---\nname: macos-spm-app-packaging\ndescription: Scaffold, build, sign, and package SwiftPM macOS apps without Xcode projects.\nrisk: safe\nsource: \"Dimillian\u002FSkills (MIT)\"\ndate_added: \"2026-03-25\"\n---\n\n# macOS SwiftPM App Packaging (No Xcode)\n\n## Overview\nBootstrap a complete SwiftPM macOS app folder, then build, package, and run it without Xcode. Use `assets\u002Ftemplates\u002Fbootstrap\u002F` for the starter layout and `references\u002Fpackaging.md` + `references\u002Frelease.md` for packaging and release details.\n\n## When to Use\n- When the user needs a SwiftPM-based macOS app without relying on an Xcode project.\n- When you need packaging, signing, notarization, or appcast guidance for a SwiftPM app.\n\n## Two-Step Workflow\n1) Bootstrap the project folder\n   - Copy `assets\u002Ftemplates\u002Fbootstrap\u002F` into a new repo.\n   - Rename `MyApp` in `Package.swift`, `Sources\u002FMyApp\u002F`, and `version.env`.\n   - Customize `APP_NAME`, `BUNDLE_ID`, and versions.\n\n2) Build, package, and run the bootstrapped app\n   - Copy scripts from `assets\u002Ftemplates\u002F` into your repo (for example, `Scripts\u002F`).\n   - Build\u002Ftests: `swift build` and `swift test`.\n   - Package: `Scripts\u002Fpackage_app.sh`.\n   - Run: `Scripts\u002Fcompile_and_run.sh` (preferred) or `Scripts\u002Flaunch.sh`.\n   - Release (optional): `Scripts\u002Fsign-and-notarize.sh` and `Scripts\u002Fmake_appcast.sh`.\n   - Tag + GitHub release (optional): create a git tag, upload the zip\u002Fappcast to the GitHub release, and publish.\n\n## Minimum End-to-End Example\nShortest path from bootstrap to a running app:\n```bash\n# 1. Copy and rename the skeleton\ncp -R assets\u002Ftemplates\u002Fbootstrap\u002F ~\u002FProjects\u002FMyApp\ncd ~\u002FProjects\u002FMyApp\nsed -i '' 's\u002FMyApp\u002FHelloApp\u002Fg' Package.swift version.env\n\n# 2. Copy scripts\ncp assets\u002Ftemplates\u002Fpackage_app.sh Scripts\u002F\ncp assets\u002Ftemplates\u002Fcompile_and_run.sh Scripts\u002F\nchmod +x Scripts\u002F*.sh\n\n# 3. Build and launch\nswift build\nScripts\u002Fcompile_and_run.sh\n```\n\n## Validation Checkpoints\nRun these after key steps to catch failures early before proceeding to the next stage.\n\n**After packaging (`Scripts\u002Fpackage_app.sh`):**\n```bash\n# Confirm .app bundle structure is intact\nls -R build\u002FHelloApp.app\u002FContents\n\n# Check that the binary is present and executable\nfile build\u002FHelloApp.app\u002FContents\u002FMacOS\u002FHelloApp\n```\n\n**After signing (`Scripts\u002Fsign-and-notarize.sh` or ad-hoc dev signing):**\n```bash\n# Inspect signature and entitlements\ncodesign -dv --verbose=4 build\u002FHelloApp.app\n\n# Verify the bundle passes Gatekeeper checks locally\nspctl --assess --type execute --verbose build\u002FHelloApp.app\n```\n\n**After notarization and stapling:**\n```bash\n# Confirm the staple ticket is attached\nstapler validate build\u002FHelloApp.app\n\n# Re-run Gatekeeper to confirm notarization is recognised\nspctl --assess --type execute --verbose build\u002FHelloApp.app\n```\n\n## Common Notarization Failures\n| Symptom | Likely Cause | Recovery |\n|---|---|---|\n| `The software asset has already been uploaded` | Duplicate submission for same version | Bump `BUILD_NUMBER` in `version.env` and repackage. |\n| `Package Invalid: Invalid Code Signing Entitlements` | Entitlements in `.entitlements` file don't match provisioning | Audit entitlements against Apple's allowed set; remove unsupported keys. |\n| `The executable does not have the hardened runtime enabled` | Missing `--options runtime` flag in `codesign` invocation | Edit `sign-and-notarize.sh` to add `--options runtime` to all `codesign` calls. |\n| Notarization hangs \u002F no status email | `xcrun notarytool` network or credential issue | Run `xcrun notarytool history` to check status; re-export App Store Connect API key if expired. |\n| `stapler validate` fails after successful notarization | Ticket not yet propagated | Wait ~60 s, then re-run `xcrun stapler staple`. |\n\n## Templates\n- `assets\u002Ftemplates\u002Fpackage_app.sh`: Build binaries, create the .app bundle, copy resources, sign.\n- `assets\u002Ftemplates\u002Fcompile_and_run.sh`: Dev loop to kill running app, package, launch.\n- `assets\u002Ftemplates\u002Fbuild_icon.sh`: Generate .icns from an Icon Composer file (requires Xcode install).\n- `assets\u002Ftemplates\u002Fsign-and-notarize.sh`: Notarize, staple, and zip a release build.\n- `assets\u002Ftemplates\u002Fmake_appcast.sh`: Generate Sparkle appcast entries for updates.\n- `assets\u002Ftemplates\u002Fsetup_dev_signing.sh`: Create a stable dev code-signing identity.\n- `assets\u002Ftemplates\u002Flaunch.sh`: Simple launcher for a packaged .app.\n- `assets\u002Ftemplates\u002Fversion.env`: Example version file consumed by packaging scripts.\n- `assets\u002Ftemplates\u002Fbootstrap\u002F`: Minimal SwiftPM macOS app skeleton (Package.swift, Sources\u002F, version.env).\n\n## Notes\n- Keep entitlements and signing configuration explicit; edit the template scripts instead of reimplementing.\n- Remove Sparkle steps if you do not use Sparkle for updates.\n- Sparkle relies on the bundle build number (`CFBundleVersion`), so `BUILD_NUMBER` in `version.env` must increase for each update.\n- For menu bar apps, set `MENU_BAR_APP=1` when packaging to emit `LSUIElement` in Info.plist.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,207,460,"2026-05-16 13:27:25",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"前端开发","frontend","mdi-language-html5","HTML\u002FCSS\u002FJavaScript\u002F框架相关",1,96,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"5e01d55f-be49-4313-9df0-592bc6ea98e7","1.0.0","macos-spm-app-packaging.zip",13997,"uploads\u002Fskills\u002F99ffd416-fa1d-4675-af68-faff4c041770\u002Fmacos-spm-app-packaging.zip","e635f21e1dafe51a5dc54fc9719da478fb942aa04eb3e13d6f9d33a2b2d22646","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":5256},{\"path\":\"agents\u002Fopenai.yaml\",\"isDirectory\":false,\"size\":216},{\"path\":\"assets\u002Ftemplates\u002Fbootstrap\u002FPackage.swift\",\"isDirectory\":false,\"size\":334},{\"path\":\"assets\u002Ftemplates\u002Fbootstrap\u002FSources\u002FMyApp\u002FResources\u002F.keep\",\"isDirectory\":false,\"size\":0},{\"path\":\"assets\u002Ftemplates\u002Fbootstrap\u002FSources\u002FMyApp\u002Fmain.swift\",\"isDirectory\":false,\"size\":173},{\"path\":\"assets\u002Ftemplates\u002Fbootstrap\u002Fversion.env\",\"isDirectory\":false,\"size\":39},{\"path\":\"assets\u002Ftemplates\u002Fbuild_icon.sh\",\"isDirectory\":false,\"size\":1518},{\"path\":\"assets\u002Ftemplates\u002Fcompile_and_run.sh\",\"isDirectory\":false,\"size\":1855},{\"path\":\"assets\u002Ftemplates\u002Flaunch.sh\",\"isDirectory\":false,\"size\":767},{\"path\":\"assets\u002Ftemplates\u002Fmake_appcast.sh\",\"isDirectory\":false,\"size\":2107},{\"path\":\"assets\u002Ftemplates\u002Fpackage_app.sh\",\"isDirectory\":false,\"size\":6119},{\"path\":\"assets\u002Ftemplates\u002Fsetup_dev_signing.sh\",\"isDirectory\":false,\"size\":1361},{\"path\":\"assets\u002Ftemplates\u002Fsign-and-notarize.sh\",\"isDirectory\":false,\"size\":1726},{\"path\":\"assets\u002Ftemplates\u002Fversion.env\",\"isDirectory\":false,\"size\":39},{\"path\":\"references\u002Fpackaging.md\",\"isDirectory\":false,\"size\":783},{\"path\":\"references\u002Frelease.md\",\"isDirectory\":false,\"size\":1251},{\"path\":\"references\u002Fscaffold.md\",\"isDirectory\":false,\"size\":1663}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]