Skip to content

[build-tools] disable apsd in iOS simulator#3795

Merged
gwdp merged 4 commits into
mainfrom
gwdp/disable-apsd-ios-simulator
Jun 2, 2026
Merged

[build-tools] disable apsd in iOS simulator#3795
gwdp merged 4 commits into
mainfrom
gwdp/disable-apsd-ios-simulator

Conversation

@gwdp
Copy link
Copy Markdown
Contributor

@gwdp gwdp commented May 27, 2026

Why

apsd (the push daemon) can't get a push token in the Simulator — a fresh Simulator has no push identity — so it retries forever and floods the system log. That keeps diagnosticd busy for the whole life of the Simulator, eating about a CPU core. Simulators can't get real pushes anyway.

Seen on Xcode 16.4, 26.2 and 26.4.

How

Disable apsd as soon as the Simulator boots, before we wait for it to be ready:

xcrun simctl spawn <udid> launchctl disable system/com.apple.apsd
xcrun simctl spawn <udid> launchctl bootout system/com.apple.apsd

If it fails, we warn and keep going. Same for cloned Simulators.

Results

Idle Simulator, Xcode 26.4:

apsd on apsd off
apsd logs/min ~100k ~0
diagnosticd CPU ~30-50% ~0%
Simulator CPU ~75% ~0%

App launch time was the same either way (~210ms).

Test Plan

Notes

Still not sure why iOS 26.0 didn't storm. There apsd connected once and went quiet, while 16.4, 26.2 and 26.4 all kept spamming — same missing token, same network. Haven't worked out what's different about 26.0.

@gwdp gwdp force-pushed the gwdp/disable-apsd-ios-simulator branch from 904a337 to 396c400 Compare May 27, 2026 07:04
@gwdp gwdp changed the title Disable apsd in iOS Simulator after boot [build-tools] Disable apsd in iOS Simulator to cut idle CPU usage May 27, 2026
@gwdp gwdp changed the title [build-tools] Disable apsd in iOS Simulator to cut idle CPU usage [build-tools] Disable apsd in iOS Simulator May 27, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.39%. Comparing base (86a891b) to head (19400d3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3795      +/-   ##
==========================================
+ Coverage   57.32%   57.39%   +0.08%     
==========================================
  Files         905      905              
  Lines       39314    39324      +10     
  Branches     8242     8242              
==========================================
+ Hits        22532    22568      +36     
+ Misses      15315    15291      -24     
+ Partials     1467     1465       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gwdp gwdp force-pushed the gwdp/disable-apsd-ios-simulator branch from 00dab2d to a2225a0 Compare May 27, 2026 16:55
@github-actions
Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

@gwdp gwdp requested review from hSATAC and sjchmiela May 27, 2026 17:11
@gwdp gwdp marked this pull request as ready for review May 27, 2026 17:11
@gwdp gwdp changed the title [build-tools] Disable apsd in iOS Simulator [build-tools] Disable apsd in iOS simulator May 27, 2026
@gwdp gwdp changed the title [build-tools] Disable apsd in iOS simulator [build-tools] disable apsd in iOS simulator May 27, 2026
@github-actions
Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
**/* @douglowder

Generated by CodeMention

Copy link
Copy Markdown
Contributor

@hSATAC hSATAC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Contributor

@sjchmiela sjchmiela left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

gwdp commented Jun 1, 2026

are we certain apsd absolutely does not work in simulators or is not needed? see https://exponent-internal.slack.com/archives/C01D24DMP98/p1778175913170849, https://developer.apple.com/forums/thread/795433?answerId&#x3D;881732022#881732022

​Thank you for the review and bubbling some of your the concerns @sjchmiela 🙏

APNS token registration in the simulator is bound to the host Mac (per the Xcode 14 release notes), and EAS workers aren't signed into any Apple ID, so apsd can't get a token regardless of the runtime. Measured through "no token found in keychain" ~130/min on iOS 18.x/26.0/26.2/26.4. Enabling the registration path would mean signing the CI workers into an Apple ID, which we currently don't.

In the other hand,simctl push doesn't go through apsd (verified — succeeds with the same output whether apsd is running or launchctl bootout'd), and that's already how Maestro delivers notifications, so disabling doesn't break anything we use. snorkling session documented at notion

Copy link
Copy Markdown
Contributor

@sjchmiela sjchmiela left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWESOME

@gwdp gwdp merged commit 543261b into main Jun 2, 2026
11 checks passed
@gwdp gwdp deleted the gwdp/disable-apsd-ios-simulator branch June 2, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants