Software:Rosetta

From HandWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Short description: Operating system component
Rosetta
Word OSX intel.jpg
Microsoft Word for PowerPC on Intel
Developer(s)Apple Inc.
Operating systemMac OS X 10.4.4–10.6.8 (Intel)
macOS 11.0–present (ARM)
Linux guest[1]
TypeBinary translation, emulation

Rosetta is a dynamic binary translator developed by Apple Inc. for macOS, an application compatibility layer between different instruction set architectures. It enables a transition to newer hardware, by automatically translating software. The name is a reference to the Rosetta Stone, the artifact which enabled translation of Egyptian hieroglyphs.[2]

The first version of Rosetta, introduced in 2006 in Mac OS X Tiger, was part of the Mac transition from PowerPC processors to Intel processors, allowing PowerPC applications to run on Intel-based Macs. Support for Rosetta was dropped with the release of Mac OS X Lion (10.7) in 2011.

Rosetta 2, introduced in 2020 as a component of macOS Big Sur, is part of the Mac transition from Intel processors to Apple silicon, allowing Intel applications to run on Apple silicon-based Macs.[3]

Background

Macintosh has used CPUs with several different instruction set architectures: the Motorola 68000 series, PowerPC, Intel x86, and ARM64 in Apple silicon. Each instruction set architecture is incompatible with its predecessor, necessitating a transition plan based on a software layer to emulate the previous instruction set on the succeeding one.

With the launch of Power Macintosh, the Mac 68K emulator is part of System 7.1.2 and later. This emulator uses PowerPC features and is embedded at the lowest levels of the operating system, integrated with the Mac OS nanokernel. This means that the nanokernel is able to intercept PowerPC interrupts, translate them to 68k interrupts (then doing a mixed mode switch, if necessary), and then execute 68k code to handle the interrupts. This allows 68k and PowerPC code to be interspersed within the same fat binary.

Rosetta

Apple launched Rosetta in 2006 upon the Mac transition to Intel processors from PowerPC. It was embedded in Mac OS X v10.4.4 "Tiger", the version that was released with the first Intel-based Macs, and allows many PowerPC applications to run on Intel-based Mac computers without modification. Rosetta is based on QuickTransit technology.[4] It has no graphical user interface, and launches as needed with no notification of the user, which led Apple to describe Rosetta as "the most amazing software you'll never see".[5] Rosetta is optionally installable in Mac OS X v10.6 "Snow Leopard".[6] Rosetta is neither included nor supported in Mac OS X Lion (10.7) or later, which therefore cannot run PowerPC applications.[6]

Because of the greater architectural differences between Intel and PowerPC processors, Rosetta operates at a higher level than the 68000 emulator does, as a user-level program that can only intercept and emulate user-level code. It translates G3, G4, and AltiVec instructions, but not G5 instructions. Although most commercial software for PowerPC-based Macs was compatible with these requirements (G4 systems were still widely used at the time), any applications that relied on G5-specific instructions had to be modified by their developers to work on Rosetta-supported Intel-based Macs. Apple advised that applications with heavy user interaction but low computational needs (such as word processors) would be best suited to use with Rosetta, and applications with high computational needs (such as games, AutoCAD, or Photoshop) would not.[7] Pre-existing PowerPC versions of Apple "Pro" media-production applications (such as Final Cut Pro, Motion, Aperture, and Logic Pro) are not supported by Rosetta and require a "crossgrade"[8] to a universal binary version to work on Rosetta-supported Intel-based Macs.

Rosetta also does not support the following:[9]

  • The Classic environment, and thus any non-Carbon application built for Mac OS 9 or earlier
  • Code that inserts preferences into the System Preferences pane
  • Applications that require precise exception handling
  • Screen savers
  • Kernel extensions and applications that depend on them
  • Bundled Java applications or Java applications with JNI libraries that cannot be translated
  • Java applets in Rosetta-translated applications, meaning that a native Intel web browser application, rather than a legacy PowerPC version, must be used to load Java applets

Rosetta 2

In 2020, Apple announced Rosetta 2 would be bundled with macOS Big Sur, to aid in the Mac transition to Apple silicon. The software permits many applications compiled exclusively for execution on x86-64-based processors to be translated for execution on Apple silicon.[3][10]

To install Rosetta 2 on an Apple silicon Mac there are two ways to do it: either by using the Terminal to install the program directly, or by trying to open an application compiled for x86-64, which will open an installation window.

In addition to the just-in-time (JIT) translation support, Rosetta 2 offers ahead-of-time compilation (AOT), with the x86-64 code fully translated, just once, when an application without a universal binary is installed on an Apple silicon Mac.[11]

Rosetta 2's performance has been praised greatly.[12][13] In some benchmarks, x86-64-only programs performed better under Rosetta 2 on a Mac with an Apple M1 SOC than natively on a Mac with an Intel x86-64 processor. One of the key reasons why Rosetta 2 provides such a high level of translation efficiency is the support of x86-64 memory ordering in the Apple M1 SOC.[14] The SOC also has dedicated instructions for computing x86 flags.[15]

Although Rosetta 2 works for most software, some software doesn't work at all[16] or is reported to be "sluggish".[17]

Similar to the first version, Rosetta 2 does not normally require user intervention. When a user attempts to launch an x86-64-only application for the first time, macOS prompts them to install Rosetta 2 if it is not already available. Subsequent launches of x86-64 programs will execute via translation automatically. An option also exists to force a universal binary to run as x86-64 code through Rosetta 2, even on an ARM-based machine.[18]

Since macOS Ventura, users running virtual machines with Linux as a guest operating system can make use of Rosetta 2 to run x86-64 code compiled for Linux,[19] within the virtual machine. Rosetta 2 works as a runtime binary, which is required to be installed on the guest operating system. There have been instances[20] of developers installing this runtime binary on third-party hardware, provided that it includes a CPU that supports at least the ARMv8.2-A instruction set; the memory ordering will be different from native x86. Some developers have noted that it might violate macOS's licensing agreements, since the runtime is bundled[21] within Apple's Virtualization framework.

See also

  • Fat binary § Apple's fat binary – combined 68k/PPC applications that run natively on both processors
  • Universal binary – combined PPC/Intel applications that run natively on both processors
  • Universal 2 binary – combined Intel/ARM applications that run natively on both processors

References

  1. "Running Intel Binaries in Linux VMs with Rosetta". Apple Inc. https://developer.apple.com/documentation/virtualization/running_intel_binaries_in_linux_vms_with_rosetta. 
  2. Norr, Henry (January 27, 2006). "Core Duo iMacs debut speedy new chips". https://www.macworld.com/article/178643/intelimacs.html. 
  3. 3.0 3.1 Warren, Tom (June 22, 2020). "Apple is switching Macs to its own processors starting later this year" (in en). https://www.theverge.com/2020/6/22/21295475/apple-mac-processors-arm-silicon-chips-wwdc-2020. 
  4. "The brains behind Apple's Rosetta: Transitive". CNET. June 8, 2005. https://www.cnet.com/tech/services-and-software/the-brains-behind-apples-rosetta-transitive/. 
  5. "Rosetta". Apple. https://www.apple.com/rosetta/. 
  6. 6.0 6.1 AppleInsider Staff (February 26, 2011). "Mac OS X Lion drops Front Row, Java runtime, Rosetta". AppleInsider. AppleInsider, Inc. http://www.appleinsider.com/articles/11/02/26/mac_os_x_lion_drops_front_row_java_runtime_rosetta.html. 
  7. "Rosetta". Universal Binary Programming Guidelines, Second Edition. Apple. https://developer.apple.com/legacy/mac/library/documentation/MacOSX/Conceptual/universal_binary/universal_binary.pdf. 
  8. "Universal Applications". Apple. https://www.apple.com/r/store/universal/. 
  9. "What Can Be Translated?". Universal Binary Programming Guidelines, Second Edition. Apple. https://developer.apple.com/legacy/mac/library/documentation/MacOSX/Conceptual/universal_binary/universal_binary.pdf. 
  10. Mayo, Benjamin (June 22, 2020). "Apple announces Mac architecture transition from Intel to its own ARM chips, offers emulation path" (in en-US). https://9to5mac.com/2020/06/22/arm-mac-apple/. 
  11. WWDC2020 Keynote. Apple Inc. June 22, 2020. Event occurs at 1h39m37s. It translates the apps when you install them, so they can launch immediately and can be instantly responsive. Rosetta 2 can also translate code on the fly when needed.
  12. Evans, Jonny (November 19, 2020). "Everything you need to know about Rosetta 2 on Apple Silicon Macs" (in en). https://www.computerworld.com/article/3597949/everything-you-need-to-know-about-rosetta-2-on-apple-silicon-macs.html. 
  13. "Yeah, Apple's M1 MacBook Pro is powerful, but it's the battery life that will blow you away" (in en-US). November 17, 2020. https://social.techcrunch.com/2020/11/17/yeah-apples-m1-macbook-pro-is-powerful-but-its-the-battery-life-that-will-blow-you-away/. 
  14. @ErrataRob. "4/ So Apple simply cheated. They added Intel's memory-ordering to their CPU. When running translated x86 code, they switch the mode of the CPU to conform to Intel's memory ordering.". https://twitter.com/ErrataRob/status/1331736203402547201.  Missing or empty |date= (help)
  15. Dougall, J (9 November 2022). "Why is Rosetta 2 fast?" (in en). https://dougallj.wordpress.com/2022/11/09/why-is-rosetta-2-fast/. "ARM flag-manipulation extensions... Apple’s secret extension..." 
  16. Carlton, Sam (December 8, 2020). "ThatGuySam/doesitarm". https://github.com/ThatGuySam/doesitarm. 
  17. "r/mac - Apps on Rosetta 2" (in en-US). November 29, 2020. https://www.reddit.com/r/mac/comments/k3544o/apps_on_rosetta_2/. 
  18. "Use Office for Mac with Rosetta and Apple silicon" (in en-US). https://support.microsoft.com/en-us/office/use-office-for-mac-with-rosetta-and-apple-silicon-18db14f2-4abc-4d93-96a4-72a01f6e9721. 
  19. Proven, Liam (9 June 2022). "Apple offers improved Linux support in macOS 13" (in en). https://www.theregister.com/2022/06/09/apple_linux_support_macos/. 
  20. Cunningham, Andrew (7 June 2022). "Apple will allow Linux VMs to run Intel apps with Rosetta in macOS Ventura" (in en-us). https://arstechnica.com/gadgets/2022/06/macos-ventura-will-extend-rosetta-support-to-linux-virtual-machines/. 
  21. "Virtualization - Running Intel Binaries in Linux VMs with Rosetta". https://developer.apple.com/documentation/virtualization/running_intel_binaries_in_linux_vms_with_rosetta. 

External links