A script to save the last backup date in SuperDuper


  1. May 1, 2018
    Fixed a bug in the script. It should now work if the filename of the log file or the target volume name contain spaces.

I’m a very happy SuperDuper user. If you’re not aware, SuperDuper is a Mac app that can create bootable clones from SSDs and hard drives — it’s a great complement to other backup strategies like Time Machine and online backup.1

Saving the date of the last backup

I have a minor quibble with the app, though: it doesn’t save the date of the last backup on the backup drive.

Part of the appeal of using an app like SuperDuper is that the backup is as close to a perfect clone of the source drive as possible. SuperDuper will not write any data to the destination drive that doesn’t exist on the source — not even a tiny little text file with a timestamp.

After-copy script

Thankfully, SuperDuper allows you to provide a shell script that is executed after a backup completes. Even better, the app passes some metadata about the copy operation (such as the paths of the source and destination volumes) to the script as command line arguments.

I wrote myself a little shell script that saves a text file named ___SuperDuper-Backup.txt in the root directory of the destination volume. The output looks like this:

SuperDuper Backup Log

Autogenerated by script: /Users/elo/bin/superduper-write-date.sh

Backup finished at: Sat Jan 27 21:00:08 CET 2018

Source volume: Main
Source volume mount path: /
Destination volume: Main-Clone-2
Destination volume mount path: /Volumes/Main-Clone-2
Backup script name: /Users/elo/Library/Application Support/SuperDuper!/Copy Scripts/Standard Scripts/Backup - all files.dset
Disk image name (if any): 

I find this very helpful. Sure, you can deduce the time of the backup from system log files etc., but it’s very convenient to have this information readily available, especially if you rotate through multiple drives.

How to install

  1. Copy the script’s source code from below and save it to a text file. I named mine superduper-write-date.sh and saved it to ~/bin in my home folder.

  2. Open SuperDuper, and click Options…. On the Advanced tab, select the script for the “Run shell script after copy completes” option.

    Screenshot of SuperDuper's Options window, with the “Run shell script after copy completes” option highlighted
    SuperDuper’s options dialog.

That’s it.

The script

Here’s the source code for the script. It’s pretty verbose, but it’s all just error handling and formatting. If you want to change the contents of the log file, feel free to edit the text between <<EOF and EOF. Also, notice the last line: I chose to play a macOS system sound to signal that the backup has finished. Feel free to delete that line or point it to a different audio file.


# Log the date of the last backup on a SuperDuper clone
# WARNING: This script overwrites the file /___SuperDuper-Backup.txt on the destination volume.

if [ ${#} -lt 5 ]; then
    echo "${0} error: expected at least 5 arguments, but there are only ${#} arguments."
    echo "Expected list of parameters:"
    echo "1. The name of the source volume (e.g. Macintosh HD)"
    echo "2. The mount path of the source volume (e.g. /)"
    echo "3. The name of the destination volume (e.g. Sandbox)"
    echo "4. The path of the destination (e.g. /Volumes/Sandbox)"
    echo "5. The name of the script the user selected (e.g. Copy – all files)"
    echo "6. (optional) The name of the image file being processed, if any"
    exit 1



cat >"${LOGFILE_PATH}" <<EOF
SuperDuper Backup Log

Autogenerated by script: ${0}

Backup finished at: $(date)

Source volume: ${SOURCE_VOLUME}
Source volume mount path: ${SOURCE_PATH}
Destination volume: ${DESTINATION_VOLUME}
Destination volume mount path: ${DESTINATION_PATH}
Backup script name: ${BACKUP_SCRIPT}
Disk image name (if any): ${DISK_IMAGE_NAME_IF_ANY}

afplay /System/Library/Sounds/Purr.aiff
  1. SuperDuper Developer Dave Nanian wrote a great series of articles about his struggle to implement APFS support in the app. I highly recommend these posts if you’re interested in APFS and what it takes for backup software to support it. Start with this post from September 2017 and then work your way forward. Money quote: APFS is basically undocumented. ↩︎