用 tmutil restore 从时间机器恢复单个文件

不打开时间机器界面,直接从备份卷的日期快照里把某个文件复制到指定位置。

macOS备份macOS文件时间机器中风险
运行 sudo tmutil restore <备份内路径> <目标路径>,最后一个参数是恢复后的落点且必须不存在同名文件。

01命令

命令
$ sudo tmutil restore /Volumes/Backup/Backups.backupdb/<Mac>/<date>/Macintosh\ HD/Users/me/doc.txt ~/Documents/doc-restored.txt

02作用说明

时间机器把快照按日期存放在 Backups.backupdb(或 APFS 备份的对应卷布局)下,你可以直接浏览备份卷找到需要的版本。tmutil restore 比普通 cp 更合适:它会像 Finder 一样连文件的时间机器元数据(如扩展属性)一起恢复。先写备份内的源路径,最后写目标路径;如果目标已存在,tmutil 会拒绝覆盖,需要先改名或移走。遇到权限问题,给终端授予“完全磁盘访问”后再试。

03风险

风险中风险
使用条件Time Machine backups available on the backup volume; sudo.
!注意: tmutil restore 不会覆盖已存在的目标文件——换个文件名或先移走旧文件。

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • tmutil(8) man page
    Xcode Man Pages (keith.github.io) · technical · 2026-09-17
    依据: Man page for tmutil: the restore verb copies items from a backup to a destination, requires the last path argument to be the destination, and warns the destination must not already exist.
  • tmutil - Time Machine management utility
    SS64 · technical · 2026-09-17
    依据: Documents `restore [-v] src … dst`: 'Restore. The last path argument must be a destination… for the restore verb, tmutil behaves largely like Finder' restoring data and Time Machine metadata.

最后验证: 2026-09-19 · 分类: 文件与文件夹

06相关方案