Skip to content

iOS signing with Fastlane Match

rn-shipyard signs iOS builds with Fastlane Match, type appstore. Match keeps your distribution certificate and provisioning profile encrypted in a private Git repo. Any Mac that can read the repo and knows the encryption password can build.

  1. Create a private Git repo for the certificates, for example git@github.com:you/certs.git. Keep it private and keep it separate from your app repo.
  2. Choose an encryption password and note your Apple Team ID.
  3. Run init:
Terminal window
export MATCH_GIT_URL=git@github.com:you/certs.git
export MATCH_PASSWORD='an-encryption-password'
export APPLE_TEAM_ID=ABCDE12345
rn-shipyard init --platform ios

init writes the URL into .shipyard/config.json and fastlane/Matchfile, then runs Match through the internal lane shipyard_match_setup (it signs in with your App Store Connect API key when one is configured, else Match asks for an Apple ID; the key file is read in place and never copied). Non-interactive with neither, init stops before fastlane, writes the files, and exits 1 with error.code: "MATCH_AUTH_MISSING" (also setup.ios.errorCode): configure the key or set FASTLANE_USER. If Match itself fails, init also exits 1 (MATCH_SETUP_FAILED, or the platform’s own code) so scripts and CI notice; the files stay and a re-run fixes it. Running it for iOS never touches your Android setup. Without a Match password it skips that step, and the summary says “Match signing NOT set up” with the next step. Run it later with rn-shipyard init --platform ios after exporting the password.

  • Locally (macOS): the keychain. fastlane match reads its passphrase from MATCH_PASSWORD, else from the keychain item with server match_<git url>. In a terminal, init offers to save it there: it runs security add-internet-password -s match_<git url> -U -w, and macOS’s security asks for the password on your terminal (it never appears in a command line or in rn-shipyard’s output). From then on you do not export MATCH_PASSWORD for builds, and doctor and the build pre-flight accept the keychain item (they only check that it exists, never read it).
  • Without a terminal: MATCH_PASSWORD=... rn-shipyard init --platform ios --save-match-password saves the value from the environment in the same item (the password goes to security -i on stdin, never into a command line). It works with --non-interactive; in a terminal it answers the offer with yes. The save happens only after Match succeeded (a mistyped password never replaces a good item; otherwise the result is not-saved), and passwords over 1024 bytes are refused. Unset or empty MATCH_PASSWORD fails with MATCH_PASSWORD_MISSING.
  • CI and --non-interactive: the environment variable MATCH_PASSWORD (a CI secret). A CI runner has no keychain item.
  • A wrong password saved in the keychain makes match fail to decrypt; delete it with security delete-internet-password -s "match_<git url>" and run init again.

If you use an App Store Connect API key for submit, init verifies it with one read-only call (GET /v1/apps for your bundle ID). A wrong key or issuer (ASC_KEY_INVALID) stops init instead of failing at your first submit. A role that is too low (it needs App Manager or Admin) and a missing app record only warn, since building does not need the key: fix them before you submit.

The Match URL is committed, so it must not contain a token. A URL such as https://x-access-token:TOKEN@github.com/org/certs.git is rejected with INVALID_MATCH_GIT_URL and nothing is written. Use one of:

  • An SSH URL, git@github.com:org/certs.git, with a key in your ssh-agent.
  • A plain https://github.com/org/certs.git plus MATCH_GIT_BASIC_AUTHORIZATION, the base64 of user:token.
Terminal window
export MATCH_GIT_BASIC_AUTHORIZATION=$(printf 'you:ghp_yourtoken' | base64)

Before the iOS build lane starts, rn-shipyard clones the Match repo itself (a bare clone into a private temporary folder, removed afterwards), so a bad credential fails in seconds, not after prebuild. In a terminal, that clone runs on your real terminal: git and ssh can ask for an ssh passphrase, https credentials or use a credential helper. The build lane then runs non-interactive, with git redirected to the local clone (Match keeps your real URL, so the passphrase in your keychain is still found), with its output piped and redacted.

With --non-interactive, --json, or CI set, nothing prompts. The clone runs in batch mode (GIT_TERMINAL_PROMPT=0, no askpass or credential-manager dialog, ssh -o BatchMode=yes) and a failed clone stops with MATCH_REPO_AUTH_FAILED. The fix is an ssh-agent with your key loaded, or a credential helper. The clone is skipped when MATCH_GIT_BASIC_AUTHORIZATION, MATCH_GIT_BEARER_AUTHORIZATION or MATCH_GIT_PRIVATE_KEY is set, because Fastlane authenticates with those without prompting.

init runs fastlane match on your own terminal when it is interactive (Apple ID, 2FA and git prompts work, output is not redacted); otherwise it is piped and detached from the terminal. See CI and scripting.

VariableMeaning
MATCH_GIT_URLMatch repo URL, no credentials in it
MATCH_PASSWORDEncryption password for the repo contents
APPLE_TEAM_IDYour Apple Developer Team ID. init uses it as the default. EXPO_APPLE_TEAM_ID is accepted as an alias for FASTLANE_TEAM_ID, the name Fastlane reads
MATCH_GIT_BASIC_AUTHORIZATIONbase64 of user:token for HTTPS repos
MATCH_GIT_BEARER_AUTHORIZATIONBearer token for HTTPS repos
MATCH_KEYCHAIN_PASSWORDKeychain password, if Match needs it
MATCH_GIT_PRIVATE_KEYPrivate key for the repo

All of the secret ones are redacted from output. See Environment variables for the full table.

build runs match(type: "appstore", readonly: true), so a build never creates or revokes certificates. Only init does that.

Match installs the profile and certificate, but Xcode does not know about them. Between Match and the archive the lane therefore applies manual signing to the app target only in the generated Xcode project (Pods and app extensions are left alone):

SettingValue
Development teamplatforms.ios.teamId from .shipyard/config.json
Provisioning profilethe profile name Match exports in sigh_<bundle id>_appstore_profile-name
Code sign identitythe certificate name Match exports (sigh_<bundle id>_appstore_certificate-name), else Apple Distribution
Bundle identifierplatforms.ios.bundleId

gym also gets export_options with signingStyle: manual and provisioningProfiles: { <bundle id> => <profile name> }. Nothing is written to app.json.

If ios/ is generated by prebuild (git-ignored or absent) it is rebuilt on the next run. If ios/ is tracked in git, project.pbxproj and the app’s Info.plist are restored byte for byte after the build, also on failure and on Ctrl-C, so your repo stays clean.

Limitation: app extensions (widgets, share extensions, App Clips) are not given a team or profile, and their profiles are not added to the export mapping. Builds of an app with extensions fail at signing for now.

Notes: manual signing is applied to every build configuration of the app target, Debug included. That is harmless with a generated ios/ (it is rebuilt) and a tracked ios/ is restored afterwards. If you edit project.pbxproj or Info.plist while a build of a tracked ios/ runs, your version is saved under .shipyard/backup/ before the restore, and a warning names the copy.

A fastlane/Fastfile written by an older rn-shipyard has no signing step, and build stops with FASTFILE_OUTDATED. Run rn-shipyard init again.

Match data cannot be decrypted without MATCH_PASSWORD. Store it in a password manager. If you lose it, you have to start over with new certificates: see Match’s nuke action in the Fastlane documentation, which revokes certificates, so read it carefully, then run init again.

rn-shipyard is an independent open-source project, not affiliated with or endorsed by Expo. Expo and EAS are trademarks of 650 Industries, Inc.