首页
/
工具
/
使用 Macvdmtool 在 Apple Silicon Mac 上执行 DFU 恢复(2021)
使用 Macvdmtool 在 Apple Silicon Mac 上执行 DFU 恢复(2021)
摘要
关于使用 macvdmtool(来自 AsahiLinux 项目的工具)通过终端命令而非键盘快捷键在 Apple Silicon 和 T2 Mac 上执行 DFU 恢复的指南。
暂无内容
查看缓存全文
缓存时间:
2026/07/03 05:17
# 使用 macvdmtool 在 Apple Silicon Mac 上执行 DFU 恢复
来源:https://www.bkurtz.io/posts/macvdmtool/
`macvdmtool` 是由 [marcan](https://github.com/marcan) 在 [AsahiLinux 项目](https://asahilinux.org/) 下编写的工具。它让你无需进行繁琐的键盘操作,只需一个简单的终端命令,即可将任何搭载 Apple Silicon 或 T2 芯片(2018 年及以后)的 Intel Mac 置于 DFU 模式。
> **注意**:`macvdmtool` 要求**宿主机**基于 **Apple Silicon**,Intel Mac 似乎不支持此工具作为宿主机。
## 前提条件
- 你需要两台 Mac 才能使用 `macvdmtool`。
- 其中一台 Mac 将充当“宿主机 Mac”。这台机器需要处于完全可用状态。
- 第二台“目标 Mac”不需要处于可用状态,只要它能正常开机并启动到问号界面或恢复模式即可。
1. 在宿主机 Mac 上,安装 [Xcode](https://developer.apple.com/xcode/),然后在终端中运行以下命令安装 Xcode 命令行工具:
`xcode-select --install`
检查是否安装成功:
`xcode-select -p`
应返回 `/Library/Developer/CommandLineTools` 或类似路径。
2. 从 Mac App Store 安装 [Apple Configurator 2](https://apps.apple.com/us/app/apple-configurator-2/id1037126344?mt=12)。
3. 克隆 `macvdmtool`:
`git clone https://github.com/AsahiLinux/macvdmtool.git`
4. 进入 macvdmtool 目录并编译工具:
`cd macvdmtool && make`
5. 将 macvdmtool 拷贝到系统路径中:
`sudo cp macvdmtool /usr/local/bin`
运行以下命令确认它已安装并添加到路径:
`which macvdmtool`
6. 启动 Apple Configurator 2 并安装“自动化工具”(Automation Tools)。
安装自动化工具对话框 → 输入密码提示。
7. 使用官方的 Apple USB-C 充电线或 TB3/TB4 线缆将宿主机 Mac 和目标 Mac 连接起来。线缆两端都必须插入 **DFU 端口**,并支持数据传输。
> 在 Apple Silicon 机器上,DFU 端口位于左侧靠近屏幕的位置。
> 在 Intel 机器上,DFU 端口位于左侧靠近触控板的位置。
8. 将目标 Mac 置于 DFU 模式:
`sudo macvdmtool /dev/cu.usbmodem*`
上述命令应返回类似以下内容:
```
Mac type: J313AP
Looking for HPM devices...
Found: IOService:/AppleARMPE/arm-io@10F00000/AppleT810xIO/i2c0@35010000/AppleS5L8940XI2CController/hpmBusManager@6B/AppleHPMBusController/hpm0/AppleHPMARM
Connection: Source Status: APP
Unlocking... OK
Entering DBMa mode... Status: DBMa
Rebooting target into DFU mode... OK
Exiting DBMa mode... OK
```
## 使用 cfgutil 进行恢复/复活
> 你也可以使用 Apple Configurator 2 或 [Finder](https://www.macrumors.com/2023/08/15/macos-sonoma-dfu-mode/) 来恢复/复活你的 Mac。
> **注意**:使用 `cfgutil` 的方法仅适用于目标 Mac 为 Apple Silicon 的情况。
1. 通过启动 Apple Configurator 2 确认设备已处于 DFU 模式。界面应如下所示。(如果未显示,请尝试拔下并重新插拔宿主机与目标之间的线缆)

2. 从 [Mr. Macintosh 的数据库](https://mrmacintosh.com/apple-silicon-m1-full-macos-restore-ipsw-firmware-files-database/) 获取你想要恢复的 IPSW 文件。
3. 使用 `cfgutil` 恢复该 IPSW:
`cfgutil restore -I ~/Downloads/UniversalMac_12.1_21C5021h_Restore.ipsw`
应输出类似以下内容:
```
objc[53015]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1da64c9e8) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104d782c8). One of the two will be used. Which one is undefined.
objc[53015]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1da64ca38) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104d78318). One of the two will be used. Which one is undefined.
cfgutil: restore: target OS is 12.1
Waiting for the device [1/2] [*******************************************] 100%
Step 2 of 2: Installing System [2/2] [**********************************>] 99%
```
此时,你应在目标 Mac 上看到苹果 Logo 和进度条。
几分钟后,Mac 将重启并启动标准的“设置助理”界面。
大功告成!尽情享受吧。
## 未来的自动化和增强功能
- 一旦 Apple 将 12.x 的 IPSW 添加到 `com_apple_macOSIPSW.xml` 反馈源(https://mesu.apple.com/assets/macos/com_apple_macOSIPSW/com_apple_macOSIPSW.xml),我可以编写一个脚本来下载最新的 IPSW,然后自动执行 macvdmtool 和 cfgutil。
- 编写 Autopkg 配方,用于下载最新的 IPSW 并将其打包到 Munki 中。这对于向技术人员分发 IPSW 很有用。
请在我的博客仓库 https://github.com/discentem/blog-content 提交 Issue 或 PR(拉取请求),或通过 MacAdmins Slack 与我联系。
## 进一步阅读有关 DFU 的内容
请参阅 Mr. Macintosh 的精彩博客文章:[对 Apple Silicon Mac 进行 DFU 恢复](https://mrmacintosh.com/restore-macos-firmware-on-an-apple-silicon-mac-boot-to-dfu-mode/),以获取更多信息。
相似文章
X AI KOLs Timeline
ntfsmac is an open-source tool that enables NTFS read/write on Apple Silicon macOS by using a libkrun microVM running ntfs-3g, avoiding kernel extensions and SIP modifications. It provides both CLI and a GUI menu-bar app.
Hacker News Top
本文介绍了一个专为 Apple Silicon 优化的 Automatic1111 分支,加入了 Metal 优化(例如 Metal Flash Attention),以加速 Stable Diffusion 1.5 的生成速度,在 M3 Pro 上将时间从 8-10 秒缩短至 3-7 秒,在 M1 Mac Mini 上从 13-20 秒缩短至 8-10 秒。
X AI KOLs Following
Asahi Linux 志愿者团队在逆向工程了摄像头和 USB 等组件后,几乎已准备好发布对 Apple M3 芯片的 Linux 支持,并且 M4 的计划已在进行中。
Hacker News Top
一位开发者详述了将MacBook Air M1设置为无头模式用于Apple平台开发的旅程,探索了虚拟机和CI服务等替代方案,同时注重成本和能源效率。
Hacker News Top
Encore 已在 Apple Silicon 上重建 Linux microVM 栈,针对 Apple 的 M1 和 M2 处理器优化虚拟化。