Integrations

Xcode run script

Build straight from Xcode, without fastlane? One build-phase script keeps every archive's symbols flowing to Pharen. The CLI needs only the dSYM path — debug ids come from the binary, your org and app from the committed .pharen.yml, and auth from PHAREN_AUTH_TOKEN.

Add the phase

In your target, go to Build Phases → + → New Run Script Phase, drag it after “Compile Sources,” and name it something like “Upload dSYMs to Pharen.” Paste:

bash
# Xcode runs build phases with a minimal PATH. Add the folder pharen is installed in.
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"

# Warn, don't fail: a symbol-upload hiccup must not break a developer build.
if [ "${DEBUG_INFORMATION_FORMAT}" = "dwarf-with-dsym" ]; then
  if command -v pharen >/dev/null; then
    pharen symbols upload "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}" \
      || echo "warning: Pharen symbol upload failed"
  else
    echo "warning: pharen not found on PATH; dSYMs not uploaded"
  fi
fi

Installed Node with a version manager such as nvm? Run npm prefix -g in Terminal and add its bin folder to that PATH line. If pharen still can't be found, the build shows a warning.

Warning instead of failing is for this phase only — a developer build must not fail on a network hiccup. Anything that distributes a build is different: a build shipped without its dSYMs produces crashes that stay unreadable until the symbols arrive, so the release lane and the fastlane plugin's pharen_release / pharen_upload_symbols actions fail by default (strict: true) rather than warning past a missing upload.

Input Files

Add both of these to the phase's Input Files. They let Xcode skip the phase when the dSYM hasn't changed, and they're part of the sandboxing story below:

text
$(DWARF_DSYM_FOLDER_PATH)/$(DWARF_DSYM_FILE_NAME)
$(DWARF_DSYM_FOLDER_PATH)/$(DWARF_DSYM_FILE_NAME)/Contents/Resources/DWARF/$(PRODUCT_NAME)

Xcode 15+ script sandboxing

New projects since Xcode 15 default to ENABLE_USER_SCRIPT_SANDBOXING = YES, which denies run-script phases network access and file access outside their declared lists. A symbol-upload phase needs the network, so under sandboxing it can't run as written. You have two choices:

  • Set ENABLE_USER_SCRIPT_SANDBOXING = NO on the target, or
  • keep sandboxing on and move symbol upload out of the build — into your CI or archive step (the fastlane plugin, the release lane, or pharen symbols upload as a post-archive step).

Keep the Input Files either way — they still let Xcode skip an unchanged dSYM.

The pharen CLI installs with npm install -g @pharen-ai/cli; your credentials come with your organization once your application is approved — see the CLI reference.