Glossary
Rosetta 2
Apple's binary translator that runs x86_64 code on Apple Silicon. AOT-translates most binaries on first launch; JIT-translates the rest at runtime.
Rosetta 2 is the binary translator Apple shipped with the M1 in 2020 to run x86_64 Mac apps transparently on ARM. It is the second Rosetta — the first translated PowerPC code on Intel back in 2006.
How it works:
- AOT (ahead-of-time): when an x86_64 binary launches for the first time, a Rosetta daemon translates its machine code into ARM and caches the result under
/var/db/oah/. Subsequent launches use the cached ARM directly — no per-launch translation cost. - JIT (just-in-time): for code generated at runtime (a JavaScript JIT, dynamic class loading), Rosetta translates it on demand.
Three details that make Rosetta interesting:
- It uses APRR/SPRR to switch the translation cache between W and X cheaply — same mechanism a native JIT engine uses.
- The chip has a hardware mode for x86 memory ordering. Apple Silicon's normal weakly-ordered model is fine for ARM but would break x86 code that assumes total store ordering. A per-thread flag puts the CPU into TSO mode while running Rosetta code.
- Syscalls go through a translation shim that fishes x86-calling-convention arguments out and dispatches into XNU's normal syscall table.
Rosetta is being deprecated. Recent macOS releases warn future versions will remove it.
See also: APRR/SPRR, the Apple Silicon article.