How to Backup and Restore Hook Data

There are several ways to backup Hook data and restore it on the same or different Macs.

Some rules:

  1. Make sure that the Mac to which you are restoring Hook’s Application Support folder (~/Library/Application\ Support/com.cogsciapps.hook) uses a version of Hook that is the same or newer than the source Mac.
  2. Before backing up or restoring Hook’s Application Support folder, exit Hook on the Mac(s).
  3. Ensure that Hook’s Application Support folder (~/Library/Application\ Support/com.cogsciapps.hook) is migrated in its entirety in a way that preserves its files’ macOS Finder extended file attributes (xattr). The methods described below achieve this.

The most common ways of backing up and restoring Hook data are:

These methods are described below.

Where does Hook store its data?

First, consider where Hook data is stored.

  1. Hook stores its link data in the ~/Library/Application\ Support/com.cogsciapps.hook folder.
  2. Hook also has a preferences file: ~/Library/Preferences/com.cogsciapps.hook.plist.
  3. Hook also creates a ~/Documents/Hook folder, which contains Hook templates and notes created with Hook.
  4. At your request, Hook can create .hook files, which by default are stored in the ~/Documents/Hook/Hook Files folder. You can move Hook files wherever you want.

Time Machine and Migration Assistant

If you enable Time Machine on the source Mac, then you can restore a previous version of Hook’s data in the way you would with any other app. Similarly, you can use Migration Assistant as you would with any other app. You can then restore your data on the same Mac or a different Mac.

Clone or ditto

You may alternatively backup and restore Hook data by using cloning software, such as Carbon Copy Cloner or Super Duper. You may also use ditto from the command line to backup and restore Hook data.

Zipping and unzipping Hook’s library folder

You may also zip the content of Hook’s ~/Library/Application\ Support/com.cogsciapps.hook. To restore Hook on the same or a different Mac, unzip this folder on the target machine.

The targets of Hook links

After you restore your Hook data, in order for Hook (or any other app) to be able to reach the target of Hook links, those targets must be reachable from the target Mac. For example, if you have links to OmniFocus tasks, those links will only be reachable if OmniFocus is installed on the target Mac and the same OmniFocus database is available there too. So you will need to restore those targets, too, if you want to continue to be able to access them with Hook.

Similarly, if pre-backup, you created links to files, those files must still be accessible for the links to be used. If the files are remounted in the same location as they were when you last used Hook, then Hook will point to them at that location.

If you happen to not remount the target files in the original location (path) and mount them at a different location instead, then Hook will attempt to find the targets of your links elsewhere. (This is part of what we mean when we say that Hook links are robust.) If in this case you have multiple copies of the target Hook files, Hook will only choose one target per link. (If that target disappears, Hook will attempt to re-anchor the link.)