# Rosetta（软件）

**Rosetta 2** 是苹果（Apple）推出的二进制翻译层，它让采用 arm64 指令集的[苹果芯片](https://www.edgepedia.org/zh/apple-silicon)（Apple silicon）Mac 能够运行针对英特尔（Intel）Mac 所用 x86_64 指令集编译的应用程序。苹果于 2020 年 6 月 22 日在全球开发者大会（WWDC）上宣布了它，同时启动了从英特尔处理器向自研芯片、为期两年的过渡；其名称取自最初的 Rosetta——那是在 2006 年前后推出的，用于在基于英特尔的 Mac 上运行 PowerPC 软件。<sup>[1](https://developer.apple.com/documentation/Apple-Silicon/about-the-rosetta-translation-environment?changes=l_1)</sup><sup> • </sup><sup>[2](https://www.macworld.com/article/234330)</sup><sup> • </sup><sup>[3](https://www.pcgamer.com/hardware/apple-turns-50-today-heres-what-it-does-better-than-pc-no-foolin/)</sup>

| 关键事实 | 详情 |
|---|---|
| 用途 | 在原生架构为 arm64 的苹果芯片 Mac 上运行包含 x86_64 指令的应用<sup>[1](https://developer.apple.com/documentation/Apple-Silicon/about-the-rosetta-translation-environment?changes=l_1)</sup> |
| 翻译模式 | 两条流水线：执行期间的即时（JIT）翻译，以及对从存储中读取的二进制文件进行的提前（AOT）翻译<sup>[4](https://support.apple.com/en-au/guide/security/secebb113be1/web)</sup> |
| 向量指令支持 | 翻译包括 AVX 和 AVX2 在内的所有 x86_64 指令，但不支持执行 AVX512 向量指令<sup>[1](https://developer.apple.com/documentation/Apple-Silicon/about-the-rosetta-translation-environment?changes=l_1)</sup> |
| 虚拟化 | 基于英特尔的虚拟化产品在 Rosetta 2 下无法运行；Rosetta 不翻译运行 x86 虚拟机所需的底层指令<sup>[5](https://www.sciencedirect.com/science/article/pii/S2666281723001300)</sup> |
| Linux 虚拟机 | 自 macOS Ventura 起，Rosetta 2 可在 arm64 Linux 虚拟机内翻译 x86-64 Linux 二进制文件<sup>[6](https://developer.apple.com/videos/play/wwdc2022/10002/)</sup> |
| 支持终止 | macOS 27 是最后一个支持 Rosetta 的版本；从 macOS 28 起，Rosetta 功能仅保留给某些依赖基于英特尔的框架、年久且无人维护的游戏<sup>[7](https://developer.apple.com/news/?id=w5ngl9k2)</sup><sup> • </sup><sup>[8](https://support.apple.com/en-euro/102527)</sup> |

## 翻译的工作原理

[Rosetta 2](https://www.edgepedia.org/zh/rosetta-2) 提供两种翻译方式。在即时流水线中，内核会在映像执行路径的早期识别出 x86_64 Mach 对象，并将控制权转交给一个特殊的 Rosetta 翻译桩，而不是动态链接编辑器 dyld；随后，该桩在执行过程中翻译 x86_64 页面，整个过程完全在进程内部完成。在提前翻译路径中，系统会在其认为对响应速度最有利的时机从存储中读取 x86_64 二进制文件，并把翻译产物作为一种特殊类型的 Mach 对象文件写回存储，并标记为另一映像的翻译产物。<sup>[4](https://support.apple.com/en-au/guide/security/secebb113be1/web)</sup>

翻译在首次启动之前就已开始。在 App Store 或软件包安装器的触发下，Rosetta 会在安装时翻译应用程序中的全部可执行代码；如果某个应用不使用苹果的安装器，用户在首次启动时可能会看到程序坞图标多弹跳一两次，因为此时才进行翻译。应用启动时，Rosetta 会加载已存储的翻译，然后完整地模拟一个 x86_64 进程，一直模拟到系统调用接口，翻译进程中的一切，包括所有系统框架。安装时未遇到的代码则会在运行时即时编译。<sup>[9](https://developer.apple.com/videos/play/wwdc2020/10686/)</sup>

Rosetta 2 按需翻译可执行页面，这使它启动可执行文件的速度远快于等待翻译整个应用；代价是它必须定期暂停执行，以翻译新的代码区域，这种开销在应用刚启动后最为明显。<sup>[10](https://developer.apple.com/videos/play/wwdc2023/10007/)</sup>

## 安全模型

安全性被整合进翻译过程本身。在使用 JIT 翻译时，当某个 x86_64 页面因缺页异常而被调入，Rosetta 会让内核将该页面的代码哈希与二进制文件所附的代码签名进行比对；如果哈希不匹配，内核就会对该进程施加相应的补救策略。<sup>[4](https://support.apple.com/en-au/guide/security/secebb113be1/web)</sup>

对于提前翻译，AOT 产物的身份源自原始的 x86_64 可执行文件。一个拥有特权的用户空间实体使用由安全隔区（Secure Enclave）管理的设备专属密钥对翻译产物进行签名，该密钥只发放给这一实体，而该实体通过一项受限授权来标识；为产物创建的代码目录中包含原始 x86_64 映像的代码目录哈希。翻译产物经过代码签名、与单台机器绑定、安全存储，并随操作系统更新而刷新。<sup>[4](https://support.apple.com/en-au/guide/security/secebb113be1/web)</sup><sup> • </sup><sup>[9](https://developer.apple.com/videos/play/wwdc2020/10686/)</sup>

为兼容性起见，存在一处不对称：苹果芯片 Mac 不允许原生 arm64 代码在没有有效签名的情况下执行，而经翻译的 x86_64 代码却可以在完全没有签名信息的情况下通过 Rosetta 执行，其运行限制与基于英特尔的 Mac 上未签名的原生代码相同。<sup>[4](https://support.apple.com/en-au/guide/security/secebb113be1/web)</sup>

安全研究人员已从攻击方的角度审视这一层。研究人员发表在《信息安全与应用杂志》（Journal of Information Security and Applications）上的一项研究记录到，现有的恶意应用与技术能够通过 Rosetta 2 发挥作用，并指出在单个进程的内存中混合英特尔与 ARM 代码，会对该平台上的内存取证与恶意软件分析产生影响。<sup>[5](https://www.sciencedirect.com/science/article/pii/S2666281723001300)</sup> FFRI 安全公司（FFRI Security, Inc.）的安全研究员中川（Koh M. Nakagawa）在黑帽亚洲大会（Black Hat Asia）上展示了“脏二进制缓存”（Dirty Bin Cache），这是一种代码注入技术，它通过让用于检查某个二进制文件此前是否已被翻译的哈希发生碰撞，来污染 Rosetta 2 的二进制翻译缓存；该技术所针对的 AOT 文件存储在 /private/var/db/oah/*/*.aot，受系统完整性保护（System Integrity Protection）保护，即使拥有 root 权限也无法修改。<sup>[11](https://www.ffri.jp/assets/files/research/research_papers/AS-23-Koh-Dirty-Bin-Cache-A-New-Code-Injection-Poisoning-Binary-Translation-Cache.pdf)</sup>

## 能力与限制

Rosetta 能运行种类繁多的软件：macOS 应用、Catalyst 应用、游戏，以及诸如内嵌 JIT 编译器的网页浏览器之类的复杂应用。使用 Metal 的应用直接为苹果 GPU 生成命令，而使用 [Core ML](https://www.edgepedia.org/zh/core-ml) 的翻译后应用可以在神经网络引擎（Neural Engine）上运行。<sup>[9](https://developer.apple.com/videos/play/wwdc2020/10686/)</sup>

指令集方面的主要缺口在于向量扩展。苹果的开发者文档指出，Rosetta 翻译所有 x86_64 指令，包括来自 AVX 和 AVX2 指令集的指令，但不支持执行 AVX512 向量指令。<sup>[1](https://developer.apple.com/documentation/Apple-Silicon/about-the-rosetta-translation-environment?changes=l_1)</sup> 2020 年全球开发者大会（WWDC）的系统架构讲座对这一限制的描述更为保守，称 Rosetta 不支持 x86 的 AVX 向量扩展，应用在使用前应已检查 AVX 支持情况。<sup>[9](https://developer.apple.com/videos/play/wwdc2020/10686/)</sup> Rosetta 对 64 位英特尔处理器的支持包括苹果列出的 ISA 扩展，外加 POPCNT 和 SSE4.2。<sup>[12](https://developer.apple.com/documentation/xcode/writing-64-bit-intel-code-for-apple-platforms)</sup>

[虚拟化](https://www.edgepedia.org/zh/virtualization)是一道硬边界：基于英特尔的虚拟化产品无法借助 Rosetta 2 运行，因为 Rosetta 不翻译运行虚拟机所需的底层英特尔指令。<sup>[5](https://www.sciencedirect.com/science/article/pii/S2666281723001300)</sup> Rosetta 也不能替代完整的 x86_64 操作系统；要在苹果芯片 Mac 上运行 x86 Linux，需要一个 arm64 发行版并搭配经 Rosetta 翻译的二进制文件，而不是一个 x86 内核。<sup>[13](https://www.veloworkspaces.com/blog/rosetta-2-linux-vms-explained/)</sup>

## 性能

翻译后的代码通常比原生 arm64 代码运行得慢，但性能损失因工作负载而异，而且在许多情况下小到足以让早期通过 Rosetta 2 运行应用的 M1 Mac 胜过原生运行相同应用的英特尔 Mac。[Ars Technica](https://www.edgepedia.org/zh/ars-technica) 对 M1 Mac mini 的评测发现，在其浏览器基准测试中，新机器上通过 Rosetta 运行的应用程序击败了在英特尔 Mac mini、[MacBook Air](https://www.edgepedia.org/zh/macbook-air) 或 13 英寸 [MacBook Pro](https://www.edgepedia.org/zh/macbook-pro) 上原生运行的英特尔应用。<sup>[14](https://arstechnica.com/gadgets/2020/11/mac-mini-and-apple-silicon-m1-review-not-so-crazy-after-all/)</sup> 有人上传了 M1 MacBook Air 通过 Rosetta 2 运行 x86 测试的 Geekbench 结果，这让 Tom's Hardware 得出结论：模拟性能并非主要问题，并指出微软 Office（Microsoft Office）等主力软件在发布时缺乏原生 M1 支持。<sup>[15](https://www.tomshardware.com/news/apple-m1-chip-emulation-geekbench-results)</sup>

然而，这一差距是真实且可测量的。在[谷歌 Chrome](https://www.edgepedia.org/zh/google-chrome)（Google Chrome）发布 M1 原生版本后，Ars Technica 的基准测试发现，在 [Speedometer](https://www.edgepedia.org/zh/speedometer) 2.0、JetStream2 和 MotionMark 1.1 中，原生版本的表现比通过 Rosetta 2 运行的 x86 版本好 66% 到 81%。<sup>[16](https://www.macrumors.com/2020/11/20/chrome-m1-macs-80-percent-faster/)</sup> 曾对翻译层做过基准测试的开发者镜直文（Naofumi Kagami）测得，在 Speedometer 2.0 上 x86 与原生 M1 的得分为 116 对 210（55%），在 JetStream2 上为 93.1 对 156.9（59%），在 MotionMark 上为 435.7 对 726.4（60%）。<sup>[17](https://naofumi.blog/2020/11/23/the-performance-of-rosetta-2-and-windows-on-arm-tranlators-emulators/)</sup>

## Linux 虚拟机中的 Rosetta 2

在 macOS Ventura 中，苹果将 Rosetta 2 扩展到了 Linux：虚拟化框架（Virtualization framework）可以与 arm64 Linux 虚拟机共享 Rosetta，后者挂载共享目录并使用 update-binfmts，使得在客户机中启动的每个 x86-64 二进制文件都由 Rosetta 翻译。苹果称该技术与 Mac 上所用的是同一项技术，性能也同样强劲。<sup>[6](https://developer.apple.com/videos/play/wwdc2022/10002/)</sup>

macOS Sonoma 为这一路径增加了缓存。由于 Rosetta 2 原本会为每个新进程重新翻译相同的库和可执行文件，虚拟化框架新增了一个运行时守护进程来管理共享的翻译缓存；客户机中的 Rosetta 运行时会从该守护进程获取预先翻译好的二进制文件，从而消除重复翻译的开销，这对编译和软件包安装等频繁调用 exec 的任务影响最大。苹果表示，Sonoma 中的性能改进使 Rosetta 2 在虚拟 Linux 环境中运行得更快。<sup>[10](https://developer.apple.com/videos/play/wwdc2023/10007/)</sup>

## 过渡的终结

苹果已为 Rosetta 的退役排定了时间表。从 macOS 26.4 开始，打开依赖 Rosetta 的应用可能会触发系统通知，提示用户改用苹果芯片原生版本。Rosetta 支持将随 macOS 27 结束，后者将是最后一个包含它的版本；该更新到来后，仅支持英特尔的应用将无法在苹果芯片 Mac 上运行。对于依赖基于英特尔的框架、年久且无人维护的游戏，Rosetta 功能将继续得到支持；苹果的支持文档指出，从 macOS 28 起，Rosetta 功能将仅适用于某些依赖基于英特尔的框架、年久且无人维护的游戏。<sup>[7](https://developer.apple.com/news/?id=w5ngl9k2)</sup><sup> • </sup><sup>[8](https://support.apple.com/en-euro/102527)</sup> 苹果对开发者的建议是将应用构建并发布为通用二进制，从而在苹果芯片和基于英特尔的 Mac 上都能原生运行。<sup>[7](https://developer.apple.com/news/?id=w5ngl9k2)</sup>

## References

1. [About the Rosetta translation environment, Apple Developer Documentation](https://developer.apple.com/documentation/Apple-Silicon/about-the-rosetta-translation-environment?changes=l_1)
2. [Apple details its transition from Intel processors to Apple silicon, Macworld (June 22, 2020)](https://www.macworld.com/article/234330)
3. [Apple turns 50 today: here's what it does better than PC, PC Gamer](https://www.pcgamer.com/hardware/apple-turns-50-today-heres-what-it-does-better-than-pc-no-foolin/)
4. [Rosetta 2 on a Mac with Apple silicon, Apple Platform Security](https://support.apple.com/en-au/guide/security/secebb113be1/web)
5. [Assessing the threat of Rosetta 2 on Apple Silicon devices, Journal of Information Security and Applications (ScienceDirect)](https://www.sciencedirect.com/science/article/pii/S2666281723001300)
6. [Create macOS or Linux virtual machines, WWDC22 Session 10002, Apple Developer](https://developer.apple.com/videos/play/wwdc2022/10002/)
7. [Upcoming changes to Rosetta support for Intel-based macOS apps, Apple Developer News (September 1, 2026)](https://developer.apple.com/news/?id=w5ngl9k2)
8. [Using Intel-based apps on a Mac with Apple silicon, Apple Support](https://support.apple.com/en-euro/102527)
9. [Explore the new system architecture of Apple silicon Macs, WWDC20 Session 10686, Apple Developer](https://developer.apple.com/videos/play/wwdc2020/10686/)
10. [Create seamless experiences with Virtualization, WWDC23 Session 10007, Apple Developer](https://developer.apple.com/videos/play/wwdc2023/10007/)
11. [Koh M. Nakagawa, Dirty Bin Cache: A New Code Injection Poisoning Binary Translation Cache, Black Hat Asia / FFRI Security](https://www.ffri.jp/assets/files/research/research_papers/AS-23-Koh-Dirty-Bin-Cache-A-New-Code-Injection-Poisoning-Binary-Translation-Cache.pdf)
12. [Writing 64-bit Intel code for Apple Platforms, Apple Developer Documentation](https://developer.apple.com/documentation/xcode/writing-64-bit-intel-code-for-apple-platforms)
13. [Rosetta 2 in Linux VMs: What It Actually Does, Velo Workspaces](https://www.veloworkspaces.com/blog/rosetta-2-linux-vms-explained/)
14. [Mac mini and Apple Silicon M1 review: Not so crazy after all, Ars Technica (November 2020)](https://arstechnica.com/gadgets/2020/11/mac-mini-and-apple-silicon-m1-review-not-so-crazy-after-all/)
15. [Apple's M1 MacBooks Are Stronger Than Intel MacBooks, Even When Emulated, Tom's Hardware (November 16, 2020)](https://www.tomshardware.com/news/apple-m1-chip-emulation-geekbench-results)
16. [Chrome for M1 Macs Runs Up to 80% Faster Than Rosetta 2 Version, MacRumors (November 20, 2020)](https://www.macrumors.com/2020/11/20/chrome-m1-macs-80-percent-faster/)
17. [The performance of Rosetta 2 and Windows on ARM translators/emulators, Naofumi Kagami (November 23, 2020)](https://naofumi.blog/2020/11/23/the-performance-of-rosetta-2-and-windows-on-arm-tranlators-emulators/)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Named software products and platforms › Cloud, virtualization, and containers

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/rosetta-software

English original: https://www.edgepedia.org/rosetta-software
