Key findings
- Rosetta 2 is a dynamic binary translator that bridges the gap between Intel and Apple Silicon CPUs.
- Rosetta 2 translates code at runtime.
- Users do not need to take any special steps to use Rosetta.
- Certain apps may have limited compatibility.
With the transition from Intel Macs to those using Apple's own Arm-based processors, the question was how software written for a specific type of processor would run on this new hardware. Rosetta 2 quickly put to rest any concerns early adopters of Apple Silicon had, but what exactly is Rosetta 2 and how does it work?
Why do we need Rosetta 2?
Rosetta 2 is a so-called dynamic binary translatorand we'll expand on that a little bit so it makes more sense.
Firstly, it is “dynamic” because Rosetta 2 does its work at runtime. That is, it starts working when you actually run the program, unlike a static translator that tries to work its magic on all of a program's code up front, rather than dynamically as needed. Preemptively translating all of your code with a static approach is not always the best solution, as it is not only time-consuming, but can simply be impossible for a static translator due to a number of factors.
For example, many modern applications use just-in-time (JIT) compilation, where code is generated at runtime. Since this code does not exist until the application is executed, it must be compiled dynamically.
In addition, applications often call libraries or external modules when needed during execution. Since these components are only loaded under certain conditions, they also require dynamic translation. Rosetta 2 is designed for these situations and translates code on the fly to ensure its compatibility with Apple Silicon.
A “binary” is a finished program that can be executed, meaning it can actually be executed by a processor. It is called a binary program because inside it is pure binary machine code (all ones and zeros). This is notable because software is not written by humans in pure binary code. Instead, it is written in a high-level programming language that resembles a human language, such as English. Languages like C or Python are examples of this, but there are countless programming languages.
This human-readable code is then converted into an executable binary file by a program called a compiler. A compiler compiled the binary code for a specific processor type. Intel processors in previous Mac generations use the x86_64 instruction set, while Apple Silicon uses the Arm instruction set.
A processor's instruction set is the list of instructions in binary or machine code that tell it to perform certain tasks. An instruction might be something like “multiply x by y” or “move information from this part of memory to that part of memory.” Both Intel and Arm CPUs can do the same type of work, but their instructions are different. So if an Arm CPU tried to execute code intended for an Intel CPU, it would either not understand the instruction or perform a different operation because the same binary code represents different instructions on each CPU.
Not only do the specific instructions differ, but the way these processors execute instructions is also very different. The “R” in Arm is short for “RISC,” or Reduced Instruction Set Computer, as opposed to the “CISC,” or Complex Instruction Set Computer architecture used by Intel CPUs. RISC CPUs execute short instructions with each clock cycle, while CISC CPUs require multiple clock cycles to execute a complex instruction.
That is why we need Rosetta 2 as “Translator” to bridge the gap between these two different processor languages.
How Rosetta 2 works
When you try to run a macOS application written for Intel-based Macs, Rosetta 2 steps in and dynamically translates the program's binary code. Simply put, it interprets the x86_64 instructions and turns them into instructions that the Apple Silicon processor can understand. This process is more sophisticated than a simple one-to-one translation and involves complex real-time optimization to ensure that the translated application runs smoothly on Apple Silicon.
Although Rosetta 2 is very powerful, the Arm binary code it generates is generally not as efficient as code from a native Arm application written specifically for Apple Silicon. These translated apps may not fully utilize all of the advanced features of Apple Silicon CPUs, so in the long run it is preferable for developers to create native versions of their apps to take full advantage of the power and features of Apple's new platform.
Related
What is RISC-V?
RISC-V is one of the newest competitors in the CPU space, but what is it and how does it compare to the competition?
How to use Rosetta 2
For you as an Apple Silicon Mac user, there is nothing special you need to do or know to take advantage of Rosetta 2. The first time you run a program that requires Rosetta 2, you will be prompted to install the software. You will also have to wait a while the first time you run an Intel Mac application, as the initial translation process can take some time. The next time you run that particular app, it should launch as quickly as a native Apple Silicon app.
Rosetta 2 has its downsides
While Rosetta 2 is pretty amazing in my experience, it's not a panacea. It's not intended to be a permanent solution to software compatibility, and software developers are expected to eventually create native Apple Silicon software. Of course, some apps that are no longer being developed and currently work with Rosetta will continue to rely on Rosetta 2. In the long term, however, most software that runs on your Mac will be native, without Rosetta 2 having to translate anything.
Applications running on Rosetta 2 will never perform quite as well as a native application. How much of a difference there is will depend on the type of application. For example, you probably won't notice a difference in an application like a word processor, but in applications that really tax your hardware, like video games or video editors, there may be a noticeable difference in performance.
I've personally never experienced this, but it's worth noting that while Rosetta 2 is highly compatible and effective, some applications just don't work properly after translation. According to Apple's developer documentation, there are some types of instructions that Rosetta 2 doesn't address, such as AVX, AVX2, and AVX512. It also doesn't work with Intel-based Mac apps that use kernel extensions, where software is allowed to load code into the operating system kernel. “Virtual machine apps that virtualize x86_64 computer platforms” are also a no-go for Rosetta 2.
Hopefully software developers whose apps are buggy or don't work at all under Rosetta 2 have ported them to Apple Silicon by now, but there will always be some older apps that are no longer being developed and will likely never work under Rosetta 2 unless Apple updates its translator to fix those specific issues. Understanding how the translation process works can at least help us understand why this can happen.