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:
- 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. - Before backing up or restoring Hook’s
Application Support
folder, exit Hook on the Mac(s). - 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:
- with macOS Time Machine and Migration Assistant,
- by cloning and restoring from a clone, or
- by zipping and unzipping Hook’s library folder.
These methods are described below.
Where does Hook store its data?
First, consider where Hook data is stored.
- Hook stores its bookmarks and link in the
~/Library/Application\ Support/com.cogsciapps.hook
folder. - Hook also has a preferences file:
~/Library/Preferences/com.cogsciapps.hook.plist
. - Hook also creates a
~/Documents/Hook
folder, which contains Hook templates and notes created with Hook. - 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.
Accessing link targets after restoring from a backup
When you use Copy Link
on an item, Hook returns a link containing a URL (an address). Often, the URL of the file will match the app’s “scheme”. For example, in OmniFocus you get OmniFocus:///
URLs. In web browsers you often get https://`. On Finder files, Hook typically copies a URL of the form
hook://file//`. They are known as “Hook file-URLs” or “Hook file-links”. Their targets can be any files. (Not to be confused with “.hook” files.)
After you restore your Hook data, in order for Hook (or any other app) to be able to reach the target of any link, its target 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 (hook://file//
), 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.)
See also
See also
- Using Hook on Multiple Macs, which explains Hook’s nifty sync service.
- Import and Export of Hook data.