# Auto-Upload dSYMs in CI for Crash Reporting

Canonical: https://figment.so/blog/mac-dsym-upload-ci-crash-reporting

After xcodebuild archive, find every .dSYM in the archive's dSYMs folder and upload it with Firebase's upload-symbols or sentry-cli debug-files upload. Fail the pipeline if an upload fails.

**After `xcodebuild archive`, find every `.dSYM` in the archive's `dSYMs/` folder and upload it with Firebase's `upload-symbols` or `sentry-cli debug-files upload`, and fail the pipeline if an upload fails.** A crash report without readable stack frames means you are debugging blind, so upload before the IPA leaves the pipeline.

This guide follows Apple's [Building your app to include debugging information](https://developer.apple.com/documentation/xcode/building-your-app-to-include-debugging-information) and Firebase's [Get deobfuscated crash reports](https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports?platform=ios).

## Why must the dSYM upload happen in CI?

Because the dSYM has to reach the crash reporter before the first crash from that build arrives. Xcode emits a dSYM alongside every binary. It maps raw memory addresses to file names, function names, and line numbers. Without the matching dSYM, Crashlytics and Sentry show hex offsets instead of Swift frames.

If a TestFlight tester crashes within minutes of install, the window to upload after the fact is already closing. Uploading from CI right after the archive step removes the human loop.

Bitcode is no longer a reason to defer the upload. Apple deprecated Bitcode submissions starting with Xcode 14 (see Apple's Xcode 14 release notes), so the dSYM your runner produces is the final dSYM. No App Store recompilation step invalidates it.

## Where does Xcode write dSYMs in an archive?

In `dSYMs/` inside the `.xcarchive`, which has a fixed layout:

```
MyApp.xcarchive/
  dSYMs/
    MyApp.app.dSYM/
      Contents/
        Resources/
          DWARF/
            MyApp
    MyFramework.framework.dSYM/
      ...
  Products/
    Applications/
      MyApp.app
```

In CI, pin the archive path with `-archivePath` so later steps can find it:

```bash
xcodebuild archive \
  -scheme "MyApp" \
  -destination "generic/platform=iOS" \
  -archivePath "$RUNNER_TEMP/MyApp.xcarchive"
```

Replace `MyApp` with the scheme name in your own `.xcodeproj` or `.xcworkspace`. Export `ARCHIVE_PATH="$RUNNER_TEMP/MyApp.xcarchive"` so the upload step uses the same value.

## How do I find every dSYM bundle?

Search the directory instead of hard-coding one path, because embedded frameworks and SwiftPM dependencies emit their own:

```bash
find "$ARCHIVE_PATH/dSYMs" -name "*.dSYM" -type d
```

That prints one line per bundle. Pipe it into `xargs` to upload them all in one pass.

## What does the complete upload script look like?

Save this as `ci/upload-dsyms.sh` and call it as a post-archive step. It handles Firebase Crashlytics (through the `upload-symbols` helper bundled with the SDK) and Sentry (through `sentry-cli debug-files upload`). `set -euo pipefail` makes a failed upload fail the pipeline, so you never get a green build with missing symbols.

```bash
#!/usr/bin/env bash
# ci/upload-dsyms.sh
# Usage: bash ci/upload-dsyms.sh <path-to.xcarchive>
#
# Crashlytics env:
#   GOOGLE_SERVICE_INFO_PLIST  absolute path to GoogleService-Info.plist
#   FIREBASE_UPLOAD_SYMBOLS    absolute path to the upload-symbols binary
# Sentry env (set in CI secret manager, not in the repo):
#   SENTRY_AUTH_TOKEN
#   SENTRY_ORG
#   SENTRY_PROJECT
set -euo pipefail

ARCHIVE_PATH="${1:?Usage: $0 <path-to.xcarchive>}"
DSYM_DIR="${ARCHIVE_PATH}/dSYMs"

if [[ ! -d "${DSYM_DIR}" ]]; then
  echo "ERROR: dSYMs directory not found at ${DSYM_DIR}" >&2
  exit 1
fi

echo "==> dSYM bundles:"
find "${DSYM_DIR}" -name "*.dSYM" -type d

if [[ -n "${FIREBASE_UPLOAD_SYMBOLS:-}" && -n "${GOOGLE_SERVICE_INFO_PLIST:-}" ]]; then
  echo "==> Uploading to Firebase Crashlytics..."
  find "${DSYM_DIR}" -name "*.dSYM" -type d -print0 | \
    xargs -0 -I {} "${FIREBASE_UPLOAD_SYMBOLS}" \
      -gsp "${GOOGLE_SERVICE_INFO_PLIST}" \
      -p ios \
      {}
  echo "==> Firebase upload complete."
else
  echo "INFO: Crashlytics env not set; skipping."
fi

if [[ -n "${SENTRY_AUTH_TOKEN:-}" ]]; then
  echo "==> Uploading to Sentry..."
  sentry-cli debug-files upload \
    --auth-token "${SENTRY_AUTH_TOKEN}" \
    --org "${SENTRY_ORG:?SENTRY_ORG is required}" \
    --project "${SENTRY_PROJECT:?SENTRY_PROJECT is required}" \
    "${DSYM_DIR}"
  echo "==> Sentry upload complete."
else
  echo "INFO: SENTRY_AUTH_TOKEN not set; skipping."
fi
```

The script is an untested example, so validate it against your own project before you trust the exit codes. Credentials stay in the CI secret manager. Nothing is written to disk, and no environment dump is produced.

## How do I upload to Firebase Crashlytics?

Point `FIREBASE_UPLOAD_SYMBOLS` at the `upload-symbols` binary that ships with FirebaseCrashlytics. Its path depends on how you integrate Firebase:

| Integration | upload-symbols path |
|---|---|
| CocoaPods | `${PODS_ROOT}/FirebaseCrashlytics/upload-symbols` |
| Swift Package Manager | `…/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/upload-symbols` |
| Manual xcframework | alongside the `FirebaseCrashlytics.xcframework` bundle |

The Firebase docs require `-gsp <path-to-GoogleService-Info.plist>` and `-p ios`, with the dSYM path as the trailing argument. Firebase's recommended pattern is the `find … | xargs … upload-symbols -gsp … -p ios {}` shape the script uses.

## How do I upload to Sentry?

Install `sentry-cli` on the runner, then run `sentry-cli debug-files upload`:

```bash
brew install getsentry/tools/sentry-cli
# or: curl -sL https://sentry.io/get-sentry-cli | bash
```

`debug-files upload` is Sentry's current command, and the older `upload-dif` alias is being retired (see Sentry's [Apple debug information files guide](https://docs.sentry.io/platforms/apple/dsym/)):

```bash
sentry-cli debug-files upload \
  --auth-token "$SENTRY_AUTH_TOKEN" \
  --org "$SENTRY_ORG" \
  --project "$SENTRY_PROJECT" \
  "$ARCHIVE_PATH/dSYMs"
```

Add `--wait` on release jobs if you want the step to block until Sentry finishes processing and returns a definitive status.

## What if an upload fails?

Keep a copy as a CI artifact first. Tokens expire, services have incidents, and networks drop. Archive the `dSYMs/` directory so you can re-upload later without rerunning the build:

```yaml
- name: Upload dSYMs as artifact
  uses: actions/upload-artifact@v4
  with:
    name: dsyms-${{ github.sha }}
    path: ${{ runner.temp }}/MyApp.xcarchive/dSYMs
    retention-days: 30
```

Tag the artifact with the commit SHA so you can match it to a specific build weeks later. For release builds you need symbols for as long as users run that version, so see [CI artifact storage and retention](/blog/mac-ci-artifact-storage-retention).

## How do I confirm symbolication works after the first CI release?

Trigger a known crash on a TestFlight build and read the dashboard:

1. Install the TestFlight build on a device.
2. Trigger a known crash gated behind a debug menu (for example `fatalError("test crash")`).
3. Open the Crashlytics or Sentry dashboard a few minutes later.
4. Confirm frames show file names and line numbers, not hex offsets.

If frames are still raw, check two things first:

- `dwarfdump --uuid MyApp.app.dSYM` matches the binary's UUID from the archive.
- The CI job for that build reported a zero exit from the upload step.

A "Missing dSYM" banner in Crashlytics means the upload never landed or the wrong bundle was pushed for that UUID.

## What is the whole pipeline in order?

| Step | Action |
|---|---|
| `xcodebuild archive` | Writes `.xcarchive` with `dSYMs/` |
| Store CI artifact | Captures `dSYMs/` before any network call |
| `upload-dsyms.sh` | Finds every `.dSYM` and pushes to Crashlytics and/or Sentry |
| Verify | Test-crash on TestFlight shows symbolicated frames |

## Can one Mac archive, capture and upload dSYMs?

Archive, dSYM capture and upload can all run on one Mac, which keeps intermediate paths local. Use the [Apple Silicon Mac VM](/mac-hosting#apple-silicon-vm) ($39 a month) for current Xcode, including Xcode 26.4 and later, which need macOS Tahoe. The [Intel Mac VM](/mac-hosting#intel-vm) ($25 a month) can archive and sign targets that build with Xcode 26.0 to 26.3 on macOS Sequoia, and it cannot run arm64-only binaries or visionOS. Pick the [Dedicated M4 Pro 48 GB](/mac-hosting#dedicated-m4-pro) ($349 a month) for parallel or heavy archives. You run your own CI.

**Related guides:**
- [Migrate from Xcode Cloud to a Self-Hosted Mac](/blog/mac-xcode-cloud-migration-self-hosted)
- [Profile and Reduce Xcode CI Build Times](/blog/mac-ci-build-time-profiling-xcode)
- [Set Up Remote Xcode on Windows](/blog/mac-xcode-on-windows-remote-setup)
