Podfile.lock hygiene and Apple Silicon simulator quirks - the CocoaPods cookbook React Native developers need when npx expo run:ios fails in Pods/, EAS Build reports a pod resolution error, or an M-series Mac picks the wrong simulator architecture.
# Preferred entry point from project root (Expo wraps CocoaPods)npx pod-install# Equivalent when already in ios/cd ios && pod install && cd ..# Full native regen (CNG) then podsnpx expo prebuild --platform iosnpx pod-install# Nuclear reset when pods are corrupted after an SDK bumprm -rf ios/Pods ios/Podfile.lock ios/buildnpx expo prebuild --platform iosnpx pod-installnpx expo run:ios
When to reach for this:
The sandbox is not in sync with the Podfile.lock after a git pull.
Adding or removing a native module (expo-camera, react-native-maps, etc.).
Upgrading Expo SDK or React Native - pod versions shift.
Simulator build fails with architecture errors on Apple Silicon.
EAS Build passes locally but fails - lockfile drift between teammates.
CommitPodfile.lock - CI and EAS must resolve identical pod versions
No (CNG / gitignored)
Lockfile is ephemeral - EAS regenerates on each build; still commit package-lock.json
# After intentional pod upgrades on committed ios/git add ios/Podfile.lockgit commit -m "chore(ios): pin pods after expo-camera add"
Step 4 - Apple Silicon simulator selection
# List runtimes - prefer arm64 (Apple Silicon) simulatorsxcrun simctl list devices available | grep -E "iPhone|Booted"# Run on a named arm64 simulatornpx expo run:ios --simulator "iPhone 16 Pro"
In Xcode → Product → Destination: avoid simulators marked Rosetta unless a legacy pod forces x86_64 (rare on SDK 57).
Step 5 - Fix "building for iOS Simulator, but linking in object file built for iOS"
If a third-party pod ships prebuilt x86_64 binaries only, options are: upgrade the pod, pick an arm64-compatible version, or temporarily use a Rosetta simulator as a bridge - not a long-term fix.
What this demonstrates:
npx pod-install is the cross-platform entry point Expo documents.
Lockfile discipline prevents "works on my Mac" EAS failures.
Architecture alignment between simulator runtime and compiled pods.
Autolinking replaces manual Podfile edits for ecosystem modules.
Config plugins may inject pod subspecs or use_frameworks! - see Config Plugins. If a plugin and manual Podfile edit conflict, plugin wins on next prebuild.
[!] CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/...
# Retry with repo updatecd ios && pod install --repo-update && cd ..# Persistent corporate proxy: set HTTP_PROXY / HTTPS_PROXY for the shell running pod install
React Native 0.86 enables New Architecture by default. Pods compile as Fabric/TurboModule-aware. If a legacy library is not compatible, expo-doctor and compile errors surface early - fix by upgrading or replacing the library, not by disabling New Arch in production without an ADR.
Stale lockfile after branch switch - sandbox sync errors. Fix:npx pod-install or delete Pods/ and reinstall.
Running pod from wrong directory - creates stray Pods/ at repo root. Fix: only run inside ios/ or use npx pod-install from root.
x86_64 simulator on arm64 Mac for daily dev - slow and architecture mismatch errors. Fix: use arm64 simulator runtimes from Xcode → Settings → Platforms.
Different CocoaPods versions across teammates - lockfile churn. Fix: document CocoaPods version in README; EAS ignores local drift by clean prebuild.