Ray's Knowledge Base
Unlock

On macOS the first run of a freshly built binary costs about 1 s; warm it before a timed test

FactVerified 2 Oct 2026Holds anywhere
Fact. A statement and the evidence for it.

Statement#

On macOS the first run of a freshly built binary takes about 1 s for the system's first-run check, so a test with a short time limit on a spawned hook or process fails once after every rebuild and then passes. Warm the binary first, for example by running rkb --version in the test before the timed step.

Evidence#

Seen in rkb's hook tests after every rebuild.

Cost accepted#

The cause is the test setup, not the code under test.

Also found by searching

  • test with a short time limit fails once after every rebuild
  • first run of a freshly built binary takes about 1 s
  • warm the binary before the timed step
  • macOS first-run check on a spawned hook or process