Mac hosting guide

CI Artifact Storage and Retention on a Mac Runner

Upload release IPAs and dSYMs to S3-compatible storage, then delete non-release artifacts older than 30 days with a nightly find -mtime script. The disk worksheet below shows when a 65GB VM is too small.

Figment editorial teamPublished Updated Facts checked November 10, 2026

Figment Mac plans

US East. Pay before use. Hourly and daily too.

Intel Mac VM4 shared vCPUs, 4GB RAM, 80GB SSD$25per monthApple Silicon Mac VM4 shared vCPUs, 4GB RAM, 65GB SSD$39per monthDedicated M4 Pro12-core CPU, 24GB RAM, 512GB SSD$199per month

Minimum first purchase: $25 of account credit, used for your rental.

Keep release IPAs and dSYMs on cheap S3-compatible storage, delete non-release artifacts older than 30 days from the Mac's local disk with the find -mtime script below, and run it as a nightly CI job. Size the disk with the worksheet at the end: a busy team can need roughly 320 GB of working space.

A busy iOS CI Mac produces gigabytes of artifacts every day: compiled binaries, test result bundles, crash symbols, and archives. Without a retention policy the disk fills and builds fail in the middle of the night. A bigger disk only delays that. A policy that keeps what you need and deletes the rest on a schedule fixes it.

What fills a CI Mac disk?

DerivedData intermediates and test result bundles fill it fastest. Use this table to target the right directories:

Artifact typeTypical size per buildSafe to delete after?
DerivedData intermediates1–4 GBYes, after build completes
.xcarchive bundle200–800 MBAfter IPA is exported and uploaded
.ipa file20–200 MBAfter 30 days (keep release builds)
.app.dSYM bundle10–100 MBNever delete release dSYMs; 30 days for PR builds
.xcresult test bundle100 MB–2 GBAfter 7–14 days
Simulator runtimes5–12 GB eachOnly when no longer needed

DerivedData can be regenerated by rebuilding, so prune it aggressively. dSYMs for released builds must survive as long as users run that version. They map binary addresses back to source file and line, and you need them to symbolicate any crash log from that build. Apple describes the debug symbol bundle in Building your app to include debugging information.

What retention policy should I use?

Use three tiers, and upload release artifacts to object storage before you delete them locally:

TierRuleStorage location
PR / branch buildsDelete all artifacts after 14 daysLocal disk only
Main branch buildsDelete after 30 days, keep dSYMs for 90 daysLocal disk; dSYMs copied to S3 at upload
Release-tagged buildsKeep foreverUpload IPA + dSYM + xcresult to S3; delete local copy after 7 days

S3-compatible storage (AWS S3, Backblaze B2, Cloudflare R2) is published at roughly $0.004–$0.023 per GB-month depending on class and provider. That is far cheaper than extra SSD capacity on any Mac host. A local disk is a working area, not an archive, and a persistent disk is not a backup.

What does the cleanup script look like?

Save this on your CI Mac and run it nightly. It walks a build output directory, skips any subdirectory containing a .release-tag marker file, deletes the rest if the directory mtime is older than N days, and prints the reclaimed total. It is an untested example, so test it against a throwaway directory before you point it at real artifacts.

#!/usr/bin/env bash
# cleanup-artifacts.sh
# Usage: ./cleanup-artifacts.sh [BUILD_DIR] [DAYS]
#
# Deletes non-release build artifacts older than DAYS days.
# Any subdirectory containing a '.release-tag' file is preserved.
# Exits non-zero on any error; prints total disk space reclaimed.

set -euo pipefail

BUILD_DIR="${1:-$HOME/ci-artifacts}"
DAYS="${2:-30}"

if [[ ! -d "$BUILD_DIR" ]]; then
  echo "ERROR: BUILD_DIR '$BUILD_DIR' does not exist." >&2
  exit 1
fi

echo "cleanup-artifacts.sh"
echo "  Directory : $BUILD_DIR"
echo "  Retention : $DAYS days (release-tagged builds exempt)"

RECLAIMED_KB=0
DELETED_COUNT=0
SKIPPED_COUNT=0

while IFS= read -r -d '' dir; do
  if [[ -f "$dir/.release-tag" ]]; then
    echo "  KEEP  $dir"
    SKIPPED_COUNT=$((SKIPPED_COUNT + 1))
    continue
  fi

  SIZE_KB=$(du -sk "$dir" 2>/dev/null | awk '{print $1}')
  rm -rf -- "$dir"
  RECLAIMED_KB=$((RECLAIMED_KB + SIZE_KB))
  DELETED_COUNT=$((DELETED_COUNT + 1))
  echo "  DEL   $dir  (${SIZE_KB} KB)"
done < <(find "$BUILD_DIR" \
           -mindepth 1 -maxdepth 1 \
           -type d \
           -mtime "+${DAYS}" \
           -print0)

RECLAIMED_MB=$(( RECLAIMED_KB / 1024 ))
echo "Done. Deleted $DELETED_COUNT directories, skipped $SKIPPED_COUNT release builds."
echo "Disk reclaimed: ${RECLAIMED_MB} MB (${RECLAIMED_KB} KB)"

After a successful release archive, have the release job write the marker:

touch "$CI_ARTIFACTS_DIR/$BUILD_TAG/.release-tag"

Replace $CI_ARTIFACTS_DIR and $BUILD_TAG with your pipeline's output directory and the tag (for example v3.4.1-release).

The script uses directory mtime, not atime, because writing any file into a directory updates its modification time, so mtime is a reliable "last build wrote here" stamp. atime updates on read and is often disabled or mounted noatime for performance.

How do I upload release artifacts before deleting them?

Run an upload script immediately after a successful release archive and before cleanup. This example uses the AWS CLI; rclone or mc work the same way against Backblaze B2 or Cloudflare R2.

#!/usr/bin/env bash
# upload-release-artifacts.sh
# Run immediately after a successful release archive, before cleanup.

set -euo pipefail

BUILD_TAG="${1:?Usage: upload-release-artifacts.sh <build-tag>}"
LOCAL_DIR="$HOME/ci-artifacts/$BUILD_TAG"
S3_BUCKET="s3://your-bucket/releases/$BUILD_TAG"

[[ -d "$LOCAL_DIR" ]] || { echo "Missing $LOCAL_DIR" >&2; exit 1; }

aws s3 cp "$LOCAL_DIR/MyApp.ipa" "$S3_BUCKET/MyApp.ipa" \
  --storage-class STANDARD_IA
aws s3 cp "$LOCAL_DIR/MyApp.app.dSYM" "$S3_BUCKET/MyApp.app.dSYM" \
  --recursive --storage-class STANDARD_IA
aws s3 cp "$LOCAL_DIR/TestResults.xcresult" "$S3_BUCKET/TestResults.xcresult" \
  --recursive --storage-class STANDARD_IA

STANDARD_IA is cheaper per GB than STANDARD for data you read only during incident investigation. Confirm the current per-class price for your region before you budget.

GitHub Actions can also hold a copy through actions/upload-artifact with a per-artifact retention-days, which cannot exceed the limit set at the repository, organization, or enterprise level. See GitHub's artifact retention documentation for the current defaults and maximums on your plan.

How do I run the cleanup nightly?

Schedule it as a CI job on the Mac runner at a low-traffic hour.

GitHub Actions:

# .github/workflows/nightly-cleanup.yml
name: Nightly artifact cleanup
on:
  schedule:
    - cron: '0 3 * * *'   # 03:00 UTC daily

jobs:
  cleanup:
    runs-on: [self-hosted, macOS]
    steps:
      - name: Run artifact cleanup
        run: |
          chmod +x "$HOME/scripts/cleanup-artifacts.sh"
          "$HOME/scripts/cleanup-artifacts.sh" "$HOME/ci-artifacts" 30

Buildkite:

steps:
  - label: ":broom: Nightly artifact cleanup"
    command: "$HOME/scripts/cleanup-artifacts.sh $HOME/ci-artifacts 30"
    agents:
      queue: nightly

Set the Buildkite pipeline schedule with your CI system's cron feature.

How much disk do I need for 50 builds a day?

About 320 GB of working set in this example. Use the per-build sizes in the first table with your own build count. The example is a team doing 50 iOS builds a day where each PR build leaves about 400 MB of retained artifacts after DerivedData is cleaned:

StreamPer-day retainedRolling accumulation
PR IPAs + xcresults (14-day)50 × 400 MB = 20 GB/day~280 GB rolling peak (14 days)
Main dSYMs (90-day, ~5 main builds/day × 50 MB)250 MB/day~22.5 GB (90 days)
Release archives (local, 7-day, ~1/week × 1 GB)~140 MB/day avg~1 GB rolling
Suggested headroom—~320 GB working set

Scale each row to your actual build count. If the rolling peak exceeds your disk, shorten the PR window (14 to 7 days roughly halves the PR row), or move PR xcresults to S3 at upload time and keep only pointers locally.

Will your artifact working set fit on the plan's disk?

It depends on the disk. The Apple Silicon Mac VM has a 65GB SSD ($39 a month), so the 50-builds-a-day example above does not fit without the shorter windows or S3 offload. The Dedicated M4 Pro 48 GB has a 512GB SSD ($349 a month) and holds the full 320 GB working set. The Intel Mac VM (80GB SSD, macOS Sequoia, Xcode 26.3 or earlier) is enough for the cleanup and upload scripts on a small team. Storage includes the OS. Figment does not back up your Mac, so upload releases to object storage. You run your own CI runner and cleanup job.

For the cache tactic that keeps DerivedData from ever reaching this script, see Incremental Xcode Builds via Derived Data Cache. For tvOS output quirks that change the size table, see Automate tvOS App Builds in a CI Pipeline. If your developers drive these runners from Windows, see Xcode on Windows Remote Setup.

Which Figment Mac fits this work?

Intel Mac VM from $25 a month, Apple Silicon Mac VM from $39, or a Dedicated M4 Pro for $199. Hourly and daily plans too. You pay before use, starting with at least $25 of account credit.

Choose a Mac plan