A .mobileprovision file is a CMS-signed plist in a known directory, so you can fetch, inspect, install and prune provisioning profiles entirely from a shell on a rented Mac. That is what removes the recurring interruption for teams that drive iOS builds from Windows or Linux. Apple's App Store Connect API reference documents the REST side, and the entitlements a profile carries are described in Adding capabilities to your app. Profiles and signing keys belong to your Apple Developer account, so keep them in your own secret manager.
Where does macOS store provisioning profiles?
Xcode 15 and earlier read profiles from:
~/Library/MobileDevice/Provisioning Profiles/
Starting with Xcode 16, Xcode writes and reads from a new location:
~/Library/Developer/Xcode/UserData/Provisioning Profiles/
xcodebuild on Xcode 16 and later follows the new path. If you also target older Xcode versions, treat both directories as authoritative and install profiles into whichever the active toolchain uses. Each profile is stored as the-UUID.mobileprovision. The UUID lives inside the signed plist, so a renewed profile gets a new UUID and sits beside the old one until you prune it. xcodebuild resolves by bundle ID and signing identity, so stale files do not usually break builds, but they make -showBuildSettings output ambiguous.
Create the directory before copying anything, because it does not exist on a clean install:
mkdir -p "$HOME/Library/Developer/Xcode/UserData/Provisioning Profiles"
How do I deliver a renewed profile without a GUI?
Download it from the Apple Developer portal, or fetch it with the App Store Connect API, then put it in the directory above.
Manual path. Download the .mobileprovision from the Apple Developer portal under Certificates, Identifiers & Profiles → Profiles. That download is on the Apple Developer site, not inside the App Store Connect app-management UI. Then scp the file to the Mac:
scp AppStore_com.example.app.mobileprovision \
user@your-mac-host:'~/Library/Developer/Xcode/UserData/Provisioning Profiles/'
You can also open a browser on the Mac and download the profile there, or have your own CI or artifact store serve it over HTTPS and curl it in.
A profile is not a public artifact. The embedded plist contains your team identifier, the included device UDIDs and, for distribution profiles, identifiers tying the signing identity to your developer account. Keep the file out of chat logs and public artifact stores, prefer short-lived signed URLs over e-mail attachments, and restrict permissions on disk.
Automated path with the App Store Connect API. Apple's API exposes GET /v1/profiles/{id}. The response's data.attributes includes profileContent (Base64 of the raw .mobileprovision bytes), uuid, name and expirationDate. Authenticate with a signed JWT built from a team API key kept in your CI secret manager, never echoed to logs and never written to a shared disk.
Shell pipelines like curl ... | python3 - <<'PY' ... PY break: the here-doc feeds the interpreter the script on stdin, so json.load(sys.stdin) sees an empty stream. Use one Python program that makes the HTTP call itself and stages the file into a private temp directory before moving it into place with the real UUID:
#!/usr/bin/env python3
# fetch-profile.py — install one provisioning profile by ID.
# Env: ASC_JWT (from your CI secret manager), PROFILE_ID (e.g. ABCDE12345).
import base64, json, os, re, stat, sys, tempfile, shutil, pathlib, urllib.request
jwt = os.environ["ASC_JWT"]
pid = os.environ["PROFILE_ID"]
dest_dir = pathlib.Path.home() / "Library/Developer/Xcode/UserData/Provisioning Profiles"
dest_dir.mkdir(parents=True, exist_ok=True)
req = urllib.request.Request(
f"https://api.appstoreconnect.apple.com/v1/profiles/{pid}",
headers={"Authorization": f"Bearer {jwt}"},
)
with urllib.request.urlopen(req, timeout=30) as resp:
payload = json.load(resp)
attrs = payload["data"]["attributes"]
uuid = attrs["uuid"]
if not re.fullmatch(r"[0-9A-Fa-f-]{10,64}", uuid):
sys.exit(f"refusing suspicious uuid: {uuid!r}")
raw = base64.b64decode(attrs["profileContent"])
# Stage into a private 0700 temp dir on the same filesystem as dest_dir,
# then atomically move the file in. mktemp-style suffix appending is avoided.
with tempfile.TemporaryDirectory(prefix="prof-", dir=str(dest_dir.parent)) as tmp:
os.chmod(tmp, stat.S_IRWXU)
staged = pathlib.Path(tmp) / f"{uuid}.mobileprovision"
staged.write_bytes(raw)
os.chmod(staged, stat.S_IRUSR | stat.S_IWUSR)
shutil.move(str(staged), dest_dir / f"{uuid}.mobileprovision")
print(f"installed {uuid}.mobileprovision ({len(raw)} bytes)")
This is an untested example. Try it once against one known profile ID and cross-check attributes.profileContent, uuid and expirationDate against the App Store Connect API release notes, because field names have shifted between revisions. Never commit the API key .p8 file; generate the JWT in-process or inject it as a secret.
How do I inspect and prune profiles from the command line?
Decode a profile with security cms -D and pull fields out with plutil -extract. Point at a concrete file, and do not leave <the-UUID> literally in the command, because <...> is input redirection in shells and fails:
# Replace REPLACE_WITH_UUID with the UUID of a profile you installed.
PROFILE="$HOME/Library/Developer/Xcode/UserData/Provisioning Profiles/REPLACE_WITH_UUID.mobileprovision"
security cms -D -i "$PROFILE" # full plist
security cms -D -i "$PROFILE" | plutil -extract ExpirationDate raw -o - - # expiry only
security cms -D -i "$PROFILE" | plutil -extract Name raw -o - - # team-visible name
ExpirationDate is emitted as an ISO-8601 UTC timestamp (for example 2026-11-10T12:00:00Z). Confirm the format against one real profile before relying on a parser. The iOS Entitlements.application-identifier entitlement is reachable with the plain dotted keypath. macOS entitlements such as com.apple.application-identifier contain dots inside the key name, so dotted keypaths will not match: extract the whole Entitlements dictionary and grep it, or write the decoded plist to a temp file and query that.
This script reports status for every installed profile and, only with --prune, removes files whose expiry has passed. It exits non-zero on any unexpected error so a CI step fails fast rather than counting a broken run as success.
#!/usr/bin/env bash
# audit-profiles.sh — list expiry; --prune removes expired files
set -euo pipefail
DIRS=(
"$HOME/Library/Developer/Xcode/UserData/Provisioning Profiles"
"$HOME/Library/MobileDevice/Provisioning Profiles"
)
PRUNE=0
[ "${1:-}" = "--prune" ] && PRUNE=1
NOW=$(date -u +%s)
printf "%-36s %-28s %-20s %s\n" UUID AppIDName ExpirationDate Status
printf -- '---\n'
shopt -s nullglob
for dir in "${DIRS[@]}"; do
[ -d "$dir" ] || continue
for f in "$dir"/*.mobileprovision; do
plist=$(security cms -D -i "$f" 2>/dev/null) || { echo "unreadable: $f"; continue; }
name=$(printf '%s' "$plist" | plutil -extract AppIDName raw -o - - 2>/dev/null || echo unknown)
exp=$( printf '%s' "$plist" | plutil -extract ExpirationDate raw -o - - 2>/dev/null || echo "")
uuid=$(basename "$f" .mobileprovision)
status="unknown"
if [ -n "$exp" ]; then
exp_epoch=$(date -j -u -f "%Y-%m-%dT%H:%M:%SZ" "$exp" +%s 2>/dev/null || echo 0)
if [ "$exp_epoch" -eq 0 ]; then
status="unparseable ExpirationDate ($exp)"
elif [ "$exp_epoch" -lt "$NOW" ]; then
if [ "$PRUNE" -eq 1 ]; then rm -- "$f"; status="EXPIRED removed"
else status="EXPIRED (rerun with --prune)"; fi
else
status="OK ($(( (exp_epoch - NOW) / 86400 )) days left)"
fi
fi
printf "%-36s %-28s %-20s %s\n" "$uuid" "$name" "$exp" "$status"
done
done
How do I confirm xcodebuild picks up the renewed profile?
Run -showBuildSettings against your own workspace and scheme, substituting the real names from your project:
xcodebuild \
-workspace "$PROJECT.xcworkspace" \
-scheme "$SCHEME" \
-configuration Release \
-showBuildSettings \
CODE_SIGN_STYLE=Manual \
PROVISIONING_PROFILE_SPECIFIER="$PROFILE_NAME" \
| grep -E 'PROVISIONING_PROFILE|CODE_SIGN_IDENTITY|DEVELOPMENT_TEAM'
If PROVISIONING_PROFILE still shows the old UUID, the stale file is still on disk. Run the audit script with --prune and repeat.
Does the Xcode version decide the Mac for profile scripts?
The profile tooling is pure command line, so the Xcode version you build with decides the plan. The Intel Mac VM ($25 a month, $2 a day) runs macOS Sequoia with Xcode 26.3 or earlier, which is enough for these scripts and for signing builds on that toolchain. Choose the Apple Silicon Mac VM ($39 a month, $6 a day) if you need Xcode 26.4 or later, Xcode 27 or arm64-only tools, and check the macOS version shown before purchase against Apple's Xcode table.
Related guides: Get SwiftUI Previews Working on a Rented Mac · Build Your First iOS App on a Rented Mac Mini · GitHub Actions Self-Hosted Runner on Mac