CLI & App Store Audit
The iosparkle command-line tool turns the publishing workflow into four commands:
| Command | Purpose |
|---|---|
next-build | Read the Channel and print the next build number. |
publish | Validate an IPA and write or upload the four Channel files. |
verify | Check a published Channel end to end. |
audit-appstore | Prove an App Store archive contains no iOSparkle residue. |
It is a standalone Swift package in cli/, built only on macOS system frameworks, with no third-party dependencies.
Install
Release builds of this repository publish a signed and notarized universal binary (iosparkle-macos-universal.tar.gz, with a SHA256SUMS file) on GitHub Releases. From a source checkout, build it yourself; it needs Swift 6 and macOS 13 or later.
swift build -c release --package-path cli
alias iosparkle="$PWD/cli/.build/release/iosparkle"
swift run --package-path cli iosparkle --help works too, without a separate build step.
Conventions
- Usage is
iosparkle <command> [options].iosparkle --helplists the commands,iosparkle <command> --helpprints the exact usage line, andiosparkle --versionprints the tool's version. - Options take a value as
--option valueor--option=value.--headerand--ssh-optionmay be repeated; any other option may be given once.--notesalways takes the next argument as literal text, even when it starts with-. --jsonprints a machine-readable result on standard output. On failure, the JSON error object goes to standard output and a human-readable line to standard error.- Exit codes.
0on success,64for a usage error,1for every other failure. On failure nothing is written to the Channel and no success output is printed, so a script can trust the exit code alone. - Fail closed. A Channel that cannot be read, a Feed that is invalid, a package that cannot be installed over the air: each is an error, never a default.
--channel-urlis absolute.publishrequireshttps;next-buildandverifyalso accepthttp, so a local test host can be checked. A trailing slash is added if missing. A URL with a user name or password is rejected.--header "Key: Value"adds a request header. Repeatable. Headers are sent with thefeed.jsonrequest only, which mirrors what the Host App can do.--timeout <seconds>is the per-request timeout,10by default.- Redirects are never followed. A
3xxis reported as an error, so a login page is never mistaken for a missing Feed.
iosparkle next-build
Usage: iosparkle next-build --channel-url <url> [--header "Key: Value"]... [--timeout <seconds>] [--json]
Reads the Channel's feed.json without any cache and prints the build number to use for the next build. It is how a CI job gets a monotonically increasing CFBundleVersion without storing state anywhere else.
feed.json response | Printed | Exit code |
|---|---|---|
200 with a valid Feed | the Feed's build plus one | 0 |
404 — the Channel does not exist yet | 1 | 0 |
Anything else: 401, 403, 5xx, a redirect, a timeout, an invalid Feed, or a Feed written for a newer schema | nothing; an error on standard error | non-zero |
Only a direct 404 counts as a new Channel. Every other unexpected outcome fails the command, so a credentials problem or an outage can never quietly reset your build numbers.
BUILD=$(iosparkle next-build --channel-url https://ota.example.com/my-app-dev --header "Authorization: Bearer $FEED_TOKEN")
With --json:
{"channelURL":"https://ota.example.com/my-app-dev/","currentBuild":118,"nextBuild":119,"status":"ok"}
iosparkle publish
Usage: iosparkle publish --ipa <path> --channel-url <url> (--out <dir> | --ssh <[user@]host:/remote/dir>)
[--ipa-url <url>] [--manifest-url <url>] [--commit <sha>] [--notes <text> | --notes-file <path>]
[--keep-builds <N>] [--ssh-port <port>] [--ssh-option <opt>]... [--force] [--json]
Takes a device-signed IPA and produces a complete Channel directory: app-<build>.ipa, manifest.plist, feed.json, and index.html.
iosparkle publish --ipa build/MyAppDev.ipa --channel-url https://ota.example.com/my-app-dev \
--out ./channel --commit "$GIT_COMMIT" --notes-file notes.txt
Published com.example.myapp.dev 1.4.0 (118) to /path/to/channel
What it checks before writing anything
Every check happens on your Mac, on a private copy of the IPA. The destination is only ever a place to put files.
The IPA
It is a regular file and a ZIP archive with exactly one app directory,
Payload/<Name>.app.Info.plisthas a non-emptyCFBundleIdentifierandCFBundleShortVersionString, and aCFBundleVersionthat is a positive integer.embedded.mobileprovisionis present and can be decoded, and its profile permits over-the-air installation: it lists devices (ProvisionedDevices), orProvisionsAllDevicesis true, orget-task-allowis true. An App Store export has none of these and is refused with:An App Store Distribution profile cannot be installed over itms-services://. Sign the IPA with Development or Ad Hoc provisioning.
The existing Channel, unless --force is given
If a
feed.jsonis already there, it must be valid, itsbundleIdmust equal the IPA's, and the IPA's build must be strictly greater than itsbuild:IPA build 119 must be greater than Channel build 119. Use --force to override.--forceoverrides all three checks at once. Use it to republish a corrected build or to move a Channel to a different bundle identifier — never to skip signing.
What it writes
app-<build>.ipa: the IPA byte for byte, as a world-readable copy (mode0644) even if your archive was owner-only.manifest.plistandfeed.json: built from the IPA'sInfo.plist.version,build,bundleId, andminimumOSVersioncome fromCFBundleShortVersionString,CFBundleVersion,CFBundleIdentifier, andMinimumOSVersion.sizeBytesandsha256are computed from the same copy.publishedAtis the current UTC time.index.html: a self-contained install page in light and dark mode, with the title, bundle identifier, version and build, size, publication time, release notes, an inline SVG QR code of the Channel URL, and the install link. The title isCFBundleDisplayName, or elseCFBundleName, or else the bundle identifier.
Then the previous packages are pruned to the number you asked to keep, and unrelated files in the directory are left alone.
Options
| Option | Meaning |
|---|---|
--ipa <path> | The IPA to publish. Required. |
--channel-url <url> | The Channel's HTTPS URL; written into the Feed and the install page. Required. |
--out <dir> | Write the Channel into a local directory. |
--ssh <[user@]host:/remote/dir> | Upload the Channel to a remote directory over SSH. Exactly one of --out and --ssh. |
--ipa-url <url> | Absolute HTTPS URL to use for the package in manifest.plist, instead of <channel URL>/app-<build>.ipa. For a package on a CDN or in a bucket. |
--manifest-url <url> | Absolute HTTPS URL written as the Feed's manifestURL, instead of manifest.plist in the Channel directory. For a manifest served by a gate in front of the Channel. |
--commit <sha> | Written to the Feed as commit. |
--notes <text> or --notes-file <path> | Written to the Feed as releaseNotes, as plain text. Exactly one of the two. |
--keep-builds <N> | How many packages to keep, including the new one. Default 2. A positive integer. |
--ssh-port <port> | SSH port for --ssh. 1 to 65535. |
--ssh-option <opt> | Extra ssh option, passed as -o. Repeatable; only with --ssh. |
--force | Skip the checks against the existing Channel. |
--json | Print the result as JSON. |
With --json:
{"build":118,"bundleId":"com.example.myapp.dev","channelURL":"https://ota.example.com/my-app-dev/","destination":"/path/to/channel","sha256":"…","sizeBytes":2222,"status":"ok","version":"1.4.0"}
Atomic publication, with no software on the destination
Whichever destination you choose, a reader never sees a half-published Channel, and a failed publish leaves the previous one intact.
--out builds the new directory beside the target and swaps it in with a single atomic rename. Packages to retain are hard-linked, so they cost nothing twice. A lock directory next to the target prevents two publishes from interleaving.
--ssh uses the system ssh and scp in batch mode, so it needs key authentication and never prompts. It uploads the four files into a staging directory on the same filesystem as the target, hard-links the packages to retain (copying if the filesystem refuses), and switches the Channel path to the new release directory with mv. From then on the Channel path is a symbolic link to the current release directory, which web roots follow by default. If anything fails before the switch, the staging directory is removed and the Channel stays as it was. The remote host needs nothing but a POSIX shell: no Python, no plutil, no script to keep in step with your local version.
iosparkle publish --ipa build/MyAppDev.ipa --channel-url https://ota.example.com/my-app-dev \
--ssh deploy@ota.example.com:/var/www/ota/my-app-dev
iosparkle verify
Usage: iosparkle verify --channel-url <url> [--ipa <local.ipa>] [--header "Key: Value"]... [--timeout <seconds>] [--json]
Fetches a published Channel exactly the way the Host App and the system installer will, and checks that every piece agrees with every other.
iosparkle verify --channel-url https://ota.example.com/my-app-dev --ipa build/MyAppDev.ipa
Verified com.example.myapp.dev 1.4.0 (118), 2222 bytes, SHA-256 db4929592b16fb031d1f5261902a741611fd18d995fdc75dc5d85d85da3eb530
In order:
- Feed.
GET feed.json, with your--headervalues. Must answer200with a valid Feed. - Manifest.
GETthe manifest URL — the Feed'smanifestURL, ormanifest.plistin the Channel. It must be an XML property list whosebundle-identifierequals the Feed'sbundleId, whosebundle-versionis the Feed'sversionor itsbuild, and that has onesoftware-packageasset with an absolute HTTPS URL. - Package. One streamed
GET, withAccept-Encoding: identity. The response must be200with a positiveContent-Lengthequal to the Feed'ssizeByteswhen present; the number of bytes received must equalContent-Length; and the SHA-256 computed while streaming must equal the Feed'ssha256when present. - Local IPA, with
--ipa. The local file's size and SHA-256 must equal those of the download.
The package is fetched with GET and never HEAD. A SigV4 presigned URL is signed for one method, and HEAD against a GET-presigned URL answers 403; a plain GET works for static and presigned packages alike. This is also why verify is safe to run against a Channel with a dynamic presigner.
With --json:
{"bundleId":"com.example.myapp.dev","build":118,"channelURL":"https://ota.example.com/my-app-dev/","sha256":"…","sizeBytes":2222,"status":"ok","version":"1.4.0"}
verify does not check MIME types or cache headers. Self-Hosting & Private Channels has the three curl commands for those.
iosparkle audit-appstore
Usage: iosparkle audit-appstore <archive-or-ipa-path> [--json]
iosparkle audit-appstore --path <path> [--json]
Accepts an .xcarchive, .ipa, or .app. Use -- before a positional path starting with '-'.
The App Store Audit proves that the artifact you are about to submit contains no self-update code and no metadata that could reveal it. It runs five checks against the .app bundle inside the artifact, and exits 0 only when none of them fails.
App Store Audit passed — /path/to/build/MyApp.xcarchive
✓ Bundle tree [pass]
✓ Info.plist hygiene [pass]
✓ Mach-O raw bytes [pass]
✓ dSYM symbols [pass]
✓ Provisioning profiles [pass]
A failure prints each finding under its check, with the path inside the artifact:
App Store Audit failed — /path/to/build/MyAppDev.xcarchive
✓ Bundle tree [pass]
✓ Info.plist hygiene [pass]
✗ Mach-O raw bytes [fail]
MyAppDev: Found 34 raw byte match(es) for iosparkle. Remove the OTA code or strings and rebuild.
MyAppDev: Found 1 raw byte match(es) for itms-services. Remove the OTA code or strings and rebuild.
MyAppDev: Found 1 raw byte match(es) for download-manifest. Remove the OTA code or strings and rebuild.
✗ dSYM symbols [fail]
dSYMs/MyAppDev.app.dSYM/Contents/Resources/DWARF/MyAppDev: Found iOSparkle symbol '…'. Remove iOSparkle from the App Store target.
✓ Provisioning profiles [pass]
The five checks
Bundle tree. No entry anywhere in the
.appdirectory may haveiosparklein its name — not a framework, a resource bundle, an app extension, or a file. The comparison ignores case, diacritics, and full-width forms, soIoSparkle.frameworkandiOSparkle.bundleare caught too. Every symbolic link is examined: its destination text must not containiosparkle, and it must resolve to a location strictly inside the bundle. Dangling, looping, and escaping links fail. The versioned links inside a framework (Versions/Current) are fine.Info.plist hygiene. Every
Info.plistin the bundle — the app's and each extension's, framework's, and resource bundle's — is read, binary or XML. NeitherLSApplicationQueriesSchemesnorCFBundleURLTypes/CFBundleURLSchemesmay declareitms-services, in any letter case. A missing or corruptInfo.plistfails rather than being skipped. iOSparkle needs no such declaration, because it opens the install URL directly instead of querying the scheme, so a clean project passes with nothing to remove.Mach-O raw bytes. Every regular file whose header identifies it as Mach-O — thin or fat, either endianness, every slice — is read as raw bytes and searched, case-insensitively, for
iosparkle,itms-services, anddownload-manifest. Each must occur zero times. Reading raw bytes is what makes the check honest: Xcode strips local symbols when archiving, sonmon the shipped binary reports nothing even while theitms-services://?action=download-manifest&url=string literal sits in the__TEXT,__cstringsection. Files that merely share a magic number with Mach-O, such as Java class files, are recognized and skipped.dSYM symbols. Every DWARF file in the archive's
dSYMsdirectory is read withxcrun nm -a -j -arch alland demangled withxcrun swift-demangle --compact. Any symbol in theiOSparkle.namespace fails, whether it is found in its demangled form or in its mangled form (9iOSparkle). An.xcarchivewith no dSYM bundles fails, with a reminder to set Debug Information Format to DWARF with dSYM File. For a bare.ipaor.app, companion dSYM bundles are looked for inside the artifact and beside it, by exact name, and scanned if present; when there are none the check reports an advisory and passes. That is the reason to audit the.xcarchivein CI: only it carries the symbols.Provisioning profiles. Every
embedded.mobileprovisionin the bundle — the app's and each extension's — is decoded withsecurity cms -D. The check fails when the profile lists devices (ProvisionedDevices), covers all devices (ProvisionsAllDevices), or allows debugging (get-task-allow): a Development, Ad Hoc, or In-House build was submitted for audit instead of an App Store build. An archive without a profile passes.
Exit code and JSON
The exit code is 0 when no check failed and 1 otherwise. Each check has a status of pass, fail, or advisory; only fail affects the exit code.
With --json:
{
"advisories": [],
"artifactPath": "/path/to/build/MyApp.xcarchive",
"artifactType": "xcarchive",
"checks": {
"bundleTree": { "findings": [], "passed": true, "status": "pass" },
"dsymSymbols": { "findings": [], "passed": true, "status": "pass" },
"infoPlist": { "findings": [], "passed": true, "status": "pass" },
"machOBytes": { "findings": [], "passed": true, "status": "pass" },
"provisioningProfile": { "findings": [], "passed": true, "status": "pass" }
},
"passed": true
}
artifactType is xcarchive, ipa, or app. A finding is { "path", "message" }, plus marker and hitCount for Mach-O byte matches. advisories repeats the message of every advisory finding.
Producing an archive worth auditing
The audit can only vouch for the artifact it is given, so build that artifact adversarially: the development archive first, and the shipping archive beside it in one products directory. Xcode normally gives each archive its own products directory, which would hide the iOSparkle.swiftmodule the development variant left behind; with one shared directory the shipping archive compiles right beside it, where a bare canImport misfires. scripts/ci-verify-audit.sh in this repository runs exactly this gate on the example projects.
DD="$(pwd)/build/DerivedData" # absolute: package build steps run from the package's own directory
PRODUCTS="$DD/Build/Products/iphoneos" # one products directory for every archive
archive() {
xcodebuild -quiet -project MyApp.xcodeproj -scheme "$1" -configuration Release \
-destination 'generic/platform=iOS' -derivedDataPath "$DD" -archivePath "build/$1.xcarchive" \
CONFIGURATION_BUILD_DIR="$PRODUCTS" \
'DWARF_DSYM_FOLDER_PATH=$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)' \
CODE_SIGNING_ALLOWED=NO archive
}
rm -rf build/*.xcarchive # never audit a stale artifact
archive MyAppDev # leaves iOSparkle.swiftmodule and iOSparkle.o in $PRODUCTS
archive MyApp # compiles beside them
iosparkle audit-appstore build/MyApp.xcarchive # must exit 0
iosparkle audit-appstore build/MyAppDev.xcarchive # positive control: must exit non-zero
Five rules make the result meaningful:
- Both archives must exit
0before anything is audited. A failed link step leaves an incomplete bundle behind, and an audit of that leftover passes for the wrong reason. - Delete stale archives first, and audit the
.xcarchiverather than an exported.ipa, so the dSYM symbol check runs. TheDWARF_DSYM_FOLDER_PATHline keeps each archive's dSYMs collectable even with the shared products directory. - Keep the positive control. Auditing the development archive must fail. If it passes, the audit is blind, and a passing shipping audit proves nothing.
- Share the products directory, with an absolute path.
CONFIGURATION_BUILD_DIRis what makes the gate honest: without it each archive compiles in its own directory and never sees the leftover module. The path must be absolute, because a local package's build steps run from the package's own directory and would resolve a relative path against it. - Audit archives, not a bare
.app. An archive's binary is stripped and its dSYMs are present, so all five checks run. An unstripped.appfrom a plain build still carries debug paths, and a checkout directory whose name containsiosparklewould trip the raw-byte check on harmless strings.
In CI
set -eu
CHANNEL=https://ota.example.com/my-app-dev
DD="$(pwd)/build/DerivedData" # absolute: CONFIGURATION_BUILD_DIR below must be too
X="xcodebuild -project MyApp.xcodeproj -derivedDataPath $DD"
BUILD=$(iosparkle next-build --channel-url "$CHANNEL")
# Publish the development build.
$X -scheme MyAppDev -configuration Release archive -archivePath build/MyAppDev.xcarchive CURRENT_PROJECT_VERSION="$BUILD"
xcodebuild -archivePath build/MyAppDev.xcarchive -exportPath build/MyAppDev \
-exportOptionsPlist ExportOptions-development.plist exportArchive
iosparkle publish --ipa build/MyAppDev/MyAppDev.ipa --channel-url "$CHANNEL" \
--out ./channel --commit "$GITHUB_SHA" --notes-file notes.txt
# upload ./channel/* to the Channel, then:
iosparkle verify --channel-url "$CHANNEL" --ipa build/MyAppDev/MyAppDev.ipa
# Gate the App Store build: both archives in one products directory, development first.
PRODUCTS="$DD/Build/Products/iphoneos"
archive() {
xcodebuild -quiet -project MyApp.xcodeproj -scheme "$1" -configuration Release -derivedDataPath "$DD" \
-destination 'generic/platform=iOS' -archivePath "build/$2.xcarchive" CONFIGURATION_BUILD_DIR="$PRODUCTS" \
'DWARF_DSYM_FOLDER_PATH=$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)' CODE_SIGNING_ALLOWED=NO archive
}
rm -rf build/MyApp.xcarchive build/MyAppDev-gate.xcarchive
archive MyAppDev MyAppDev-gate
archive MyApp MyApp
iosparkle audit-appstore build/MyApp.xcarchive # must exit 0
iosparkle audit-appstore build/MyAppDev-gate.xcarchive && exit 1 || true # positive control: must fail
The two directions of the check belong together and run on every pull request: the shipping archive must pass, and the development archive must fail. scripts/ci-verify-audit.sh does this for the two example projects in Examples/.