One-click restore most recent backup of a file from Time Machine

Often I want to restore the latest version of a file from Time Machine, but using the Time Machine interface to do so is awkward and slow. So I came up with my own solution that can be triggered from the Finder context menu of any file.

Usage

  1. right-click on a file
  2. select “Restore from Time Machine
  3. file is trashed (recoverable using Trash’s Put Back feature)
  4. most recent backup of that file is restored from Time Machine

This takes a seconds or two, depending on the size of the file in question. Most importantly this saves interrupting my workflow by having to opening the Time Machine interface and zooming through all those windows looking for the file.

Requirements

These apps let you add items to Finder’s right-click context menu, from where you can run your own scripts that do something with the full path of the file/s selected.

  • trash, a shell script to delete files with support for Put Back

  • tmutil, built-in macOS utility for interacting with Time Machine

ContextMenu.app

Create a “New Action with Shell Script…” as follows:

Scripts

There are a couple of scripts because backups are stored differently on USB and Network. Of course, you’ll also need to change the path names to suit your setup.

Other uses

You could also install the script to enable it to be used from the command line.

--
Comments: @gingerbeardman