Sometimes you need to quickly restore a file from your macOS Time Machine backups without using the pretty graphical interface.

  1. Commands
  2. Related stuff

Commands

First retrieve the list of all available backups:

tmutil listbackups

When you get an error “No machine directory found for host” it probably means Time Machine is doing a backup or verification at the moment. Try again later.

You can check the status and get an ETA with:

tmutil status

Restore your file:

tmutil restore BACKUP / ORIGINAL DESTINATION

Note: don’t forget to either wrap the paths in quotes or escape all spaces and special characters!

BACKUP

/Volumes/Time Machine Backups/Backups.backupdb/ComputerName/2017-10-19-064032

The starting path can be different for non-English installations. For example on Dutch macOS the path starts with /Volumes/Time Machine-reservekopiƫn.

ORIGINAL

/Macintosh HD/Users/username/Documents/my_lost.doc

Here the start can also be different when you have named you Mac’s disk differently.

DESTINATION

~/Documents/my_lost_doc

So the full restore command becomes:

tmutil restore '/Volumes/Time Machine Backups/Backups.backupdb/ComputerName/2017-10-19-064032/Macintosh HD/Users/username/Documents/my_lost.doc' '~/Documents/my_lost_doc'

 

Based on: Hacks for Macs