Hook files are plain text files with the “.hook” filename extension. They can contain any valid address (“URI”), whether or not the address is a hook://. For instance, you can insert a link to a website (such as https://apple.com), an OmniFocus task (such as:
omnifocus:///task/nGSe83xr2tE), or any other address for that matter.
When you double-click/tap on a Hook file in the Finder, Hook parses the address, and makes a system call to open the linked item.
Hook files are like aliases and web location (.webloc) files. Like Finder aliases they can link to other files. Like Finder “.webloc” files, they can link to web pages.
But they are better than aliases and web locations in many respects:
- They can contain any URL (address) that your macOS instance can resolve. Typically that will be files and folders, but the URL scheme can be anything your Mac can handle, such as bear:, bookreader:, x-devonthink-item:, x-nvultra:, or spotify: if your Mac has an app that can open the respective URL. For instance, DEVONthink 3 to open
- Hook does not require that the URL scheme be of an app that has automation beyond an app being able to opening the URL.
- .hook files can therefore also contain hook:// links . So a .hook file can refer to an email (hook://email), a file or folder (hook://file), or a Spotlight search (hook://search).
- .hook files work well when stored inside version control system and locally synced shared folders.
- .hook files can survive in cases where aliases break. Examples where aliases break but .hook files are fine: when they contain a hook://file URL referring to a file in a version control system repository that has been locally deleted but checked out elsewhere; or if you copy a referenced file onto a different physical medium altogether, such as an SSD drive) and then delete the original referenced file.
- You can even include Markdown links in your .hook files!
So, for example, you can put the following Markdown link in a “.hook” file:
[Make Hook File](https://hookproductivity.com/help/hook-window/make-hook-file/)
If you double click on that .hook file, Hook will ask macOS to open that web link. And you’ll be back here in your default web browser :).
Make Hook File command is a Pro feature. However, you can also construct Hook files manually by creating a plain text file that has a “.hook” filename extension. Just include whatever address (URI) or Markdown link you’d like Hook to execute.
When you use the
Make Hook File command from the Desktop, Hook will try to put a Hook file in the same folder as a current selection, which must be a single file or resource. You can also create a Hook file using the Hook window in the context of other apps than Finder. In that case, Hook will create a Hook file from the current resource and put in the “Hook Files” folder of your Hook folder.
However, unlike aliases to folders, you can’t drag and drop files on .hook files that point to folders.
Use them in version control systems too
If you want to include a reference to anything in a version control system (such as Git or subversion), then put a .hook file there so you and your colleagues can quickly access it.
For example, if a document or code package folder, F1, has been replaced by another, F2, consider including in folder, F1, a .hook file pointing to folder, F2. That way, when you and your colleagues later stumble into F1 you can quickly get to the new version.
Use them in cloud synced folders (e.g., Dropbox or iCloud Drive folders)
You can include .hook files pointing to anything in Dropbox folders too. But keep these idiosyncrasies of Dropbox in mind if you want to refer to Dropbox folders.
You might even want to include in a shared folder
- a hook://.email link that explains something about it,
- a link to an internal web page on the issue, or
- a link to a file in a version control system.
“One app, infinite applications”
Hook’s “One app, infinite applications” slogan is also true of .hook files! Once you start using .hook files, you will realize just how useful they are. Feel free to share the fun you are having with .hook files on the Hook productivity forum 🙂 .