# Export and Manage Xcode Archives Remotely

Canonical: https://figment.so/blog/mac-xcode-organizer-archives-remote

Run xcodebuild -exportArchive with a new ExportOptions.plist to re-sign an existing archive without recompiling. Figment's Intel Mac VM ($25 a month) handles this on Xcode 26.3 or earlier.

**Keep your `.xcarchive` bundles on a Mac and run `xcodebuild -exportArchive` with a new `ExportOptions.plist` to produce a freshly signed IPA without recompiling.** The commands below come from Apple's [Distributing your app for beta testing and releases](https://developer.apple.com/documentation/xcode/distributing-your-app-for-beta-testing-and-releases) and [Technical Note TN2339](https://developer.apple.com/library/archive/technotes/tn2339/_index.html).

Export and re-sign jobs do not need Apple silicon, so Figment's Intel Mac VM ($25 a month, $2 a day) can run them with Xcode 26.3 or earlier, the range Apple lists for macOS Sequoia. If your project needs Xcode 26.4 or later, use an Apple silicon plan.

## Where does Xcode store archives?

Xcode writes every archive under a date-partitioned directory in your user library:

```
~/Library/Developer/Xcode/Archives/
  2026-11-10/
    MyApp 2026-11-10 14.23.11.xcarchive/
  2026-11-09/
    MyApp 2026-11-09 09.01.44.xcarchive/
```

An `.xcarchive` is a bundle (a directory with a known structure), not a flat file:

```
MyApp.xcarchive/
  Info.plist          - archive metadata: scheme, creation date, app version
  Products/
    Applications/
      MyApp.app       - the compiled binary with its frameworks
  dSYMs/
    MyApp.app.dSYM    - debug symbols for crash reporting
  BCSymbolMaps/       - bitcode symbol maps (older Xcode projects only)
```

`Products/Applications/MyApp.app` is the compiled binary. The `dSYMs` are what your crash reporter needs to symbolicate stack traces. Keep both together when you copy archives to a file server or object store.

## How do I list and inspect archives from the command line?

Open a terminal on the Mac (an SSH session works) and run these from the archives directory:

```bash
# List all archives, most recent first
find ~/Library/Developer/Xcode/Archives \
  -name "*.xcarchive" \
  -maxdepth 2 \
  | sort -r

# Show the archived app version
/usr/libexec/PlistBuddy -c "Print :ApplicationProperties:CFBundleShortVersionString" \
  ~/Library/Developer/Xcode/Archives/2026-11-10/*.xcarchive/Info.plist

# Check the codesign identity currently embedded in the archive
codesign -dv --verbose=4 \
  ~/Library/Developer/Xcode/Archives/2026-11-10/*.xcarchive/Products/Applications/MyApp.app \
  2>&1 | grep -E "Authority|TeamIdentifier|Identifier"
```

The `codesign` output shows which signing identity and team built the archive. If you re-sign for a different distribution channel, confirm the replacement identity is already in the Mac's keychain before you export.

## How do I get signing material onto the Mac?

Move the certificate and private key as an encrypted PKCS#12 (`.p12`) file. Export it from the source keychain with a strong passphrase, transfer it over a channel that protects the file, and import it with `security import` into a dedicated keychain (or open it from the desktop). Never write the private key to a plaintext file.

Provisioning profiles are separate `.mobileprovision` files. Copy them to `~/Library/MobileDevice/Provisioning Profiles/`. They are not stored in Keychain. For CI, keep secrets in your CI secret manager and reference them by name, and do not commit an `env` dump that might include unrelated tokens.

## How do I re-export an archive with a different ExportOptions.plist?

Run `xcodebuild -exportArchive` with the archive, an export options plist and an output directory. This script wraps it:

```bash
#!/usr/bin/env bash
# re_export.sh - re-export an existing .xcarchive to a new IPA.
# Usage: bash re_export.sh /path/to/MyApp.xcarchive /path/to/ExportOptions.plist /path/to/output/
set -euo pipefail

ARCHIVE_PATH="$1"
EXPORT_PLIST="$2"
OUTPUT_DIR="$3"

[[ -d "$ARCHIVE_PATH" ]] || { echo "ERROR: archive not found at $ARCHIVE_PATH" >&2; exit 1; }
[[ -f "$EXPORT_PLIST"  ]] || { echo "ERROR: ExportOptions.plist not found at $EXPORT_PLIST" >&2; exit 1; }

mkdir -p "$OUTPUT_DIR"

echo "==> Re-exporting $(basename "$ARCHIVE_PATH")"
xcodebuild -exportArchive \
  -archivePath "$ARCHIVE_PATH" \
  -exportPath "$OUTPUT_DIR" \
  -exportOptionsPlist "$EXPORT_PLIST"

echo "==> IPA written to $OUTPUT_DIR"
ls -lh "$OUTPUT_DIR"/*.ipa
```

A minimal `ExportOptions.plist` for App Store Connect distribution:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>method</key>
  <string>app-store-connect</string>
  <key>teamID</key>
  <string>YOURTEAMID</string>
  <key>uploadSymbols</key>
  <true/>
</dict>
</plist>
```

Current Xcode 16 export methods (from local `xcodebuild -help` on Xcode 16.4) are `app-store-connect`, `release-testing`, `enterprise`, `debugging`, `developer-id`, `mac-application` and `validation`. The names `app-store`, `ad-hoc` and `development` are deprecated aliases. Confirm the string your installed Xcode accepts with `xcodebuild -help | sed -n '/exportOptionsPlist/,/^ *$/p'` before you commit the plist. For an Ad Hoc build, also map each bundle ID to a profile:

```xml
<key>method</key>
<string>release-testing</string>
<key>provisioningProfiles</key>
<dict>
  <key>com.example.MyApp</key>
  <string>MyApp AdHoc Profile</string>
</dict>
```

The shortest safe way to get a correct plist for a new distribution method is to export once through Xcode Organizer on the Mac, let Xcode write the plist beside the IPA, and reuse that file as your template.

## How do I validate the IPA before uploading?

Run `xcrun altool --validate-app` for iOS, or `xcrun notarytool` for Mac notarization. `altool` still ships in current Xcode, but Apple is narrowing its surface, so check `xcrun altool --help` and the release notes for your version:

```bash
xcrun altool --validate-app \
  -f "$OUTPUT_DIR/MyApp.ipa" \
  -t ios \
  --apiKey YOUR_KEY_ID \
  --apiIssuer YOUR_ISSUER_ID
# altool looks for the .p8 under ./private_keys, ~/private_keys,
# ~/.private_keys, or ~/.appstoreconnect/private_keys.
```

To see which provisioning profile is embedded, with no network call:

```bash
unzip -p "$OUTPUT_DIR/MyApp.ipa" "Payload/MyApp.app/embedded.mobileprovision" \
  | security cms -D 2>/dev/null \
  | /usr/libexec/PlistBuddy -c "Print :Name" /dev/stdin
```

## How much disk do archives need?

A mid-size iOS app's `.xcarchive` typically runs 300 to 800 MB with dSYMs. If you keep the last 10 production archives plus two months of nightly CI archives (about 60 more), a 600 MB average fills about 42 GB (70 archives x 0.6 GB).

| Figment plan | Storage (includes the OS) | After 42 GB of archives |
| --- | --- | --- |
| Intel Mac VM | 80GB SSD | Under 38 GB left for macOS, Xcode, caches and work area |
| Apple Silicon Mac VM | 65GB SSD | Does not fit with macOS and Xcode |
| Dedicated M4 Pro | 512GB SSD | Under 470 GB left |

Storage includes macOS, so the free figures are upper bounds. On the Intel VM that is workable for export and re-sign jobs and tight once you also build. A persistent disk is not a backup, and Figment does not back up your Mac, so copy archives to your own artifact store.

## How do I clean up old archives?

Add a prune step to your release checklist so the disk does not fill silently:

```bash
# List archives older than 30 days with their sizes
find ~/Library/Developer/Xcode/Archives \
  -name "*.xcarchive" \
  -mtime +30 \
  -exec du -sh {} \;

# Delete archives older than 60 days (review the list above first)
find ~/Library/Developer/Xcode/Archives \
  -name "*.xcarchive" \
  -mtime +60 \
  -exec rm -rf {} +
```

Keep at least the last two production archives on disk so you can re-export if a signing incident forces a certificate rotation. Upload dSYMs to your crash reporter at build time so deleting an archive does not cost you symbolication.

## What should I check before closing a release?

- [ ] Archive built from the tagged commit, not an untagged development branch.
- [ ] `codesign -dv` confirms the intended distribution identity and team ID.
- [ ] `ExportOptions.plist` method matches the channel (`app-store-connect`, `release-testing`, `developer-id`, and so on).
- [ ] `xcrun altool --validate-app` passes before upload.
- [ ] dSYMs uploaded to the crash reporter.
- [ ] Archive copied to your artifact store for the retention window.
- [ ] Archives older than retention pruned from the Mac.

## What Mac handles archive export and re-sign jobs?

The Intel Mac VM ($25 a month or $2 a day, Xcode 26.3 or earlier) fits export and re-sign jobs on older toolchains. Choose the Apple Silicon Mac VM ($39 a month) when your project needs Xcode 26.4 or later or arm64-only tools. Compare them on the [Mac hosting plans](/mac-hosting) page.

**Related guides:**
- [Run an Accessibility Audit in Xcode Remotely](/blog/mac-accessibility-audit-xcode-remote)
- [Run the visionOS Simulator on a Rented Mac](/blog/mac-visionos-simulator-rented-mac)
- [Set Up a GitHub Actions Self-Hosted Runner on a Mac](/blog/mac-github-actions-self-hosted-runner)
