Hook sync between two Mac machines

I am having some difficulties syncing the hook links between two Mac machines. Basically I move the whole Hook/ folder to iCloud drive, thinking that if both machines share the same cloud drive, then they can share the notes and also using hooksync links as well.

So I created a markdown document and linked it to a website in machine A. Then I ensure that the Hook app in both machines are referring to the same hooksync directory and activated them, also both machines refer to the same hook notes directory.

Unfortunately, when I open the same Markdown document in machine B, I am unable to see the linked website.

Here is the catch: Machine Aā€™s user has a different username compare to Machine B. But I created a symlink in Machine B as /Users/MachineAUserName to point to /Users/MachineBUserName.

Previously I was testing this with Dropbox (the Hook folder under Dropbox) - but the dropbox folder paths are quite different in both machines, so I switched to iCloud drive, which should be the same in both machines, i.e. /Users/X/Library/Mobile Document/ā€¦

Any advice or help would be much appreciated.

Thanks in advance.

Is it the same Apple ID signed into iCloud on both machines? Iā€™d expect thatā€™s mandatory.

I also think symlinking between users will be problematic. There will be permissions issues.

Yes, both machines were signed in with the same Apple ID, only the local usernames are different.

Hi, zhaokoh.

  1. do you see the links go into the chosen iCloud folder on each Mac that has Hook links?
  2. have you checked that the files are syncing via iCloud? The sync is predicated on the data in the folder syncing via whatever sync mechanism is used. Is iCloud behaving well for you irrespective of Hook?

the paths donā€™t need to be the same. Each Hook instance merely looks at the folder in the macOS account in which it is running. Hook itself has no model of where the folder originates from, or whether the folderā€™s content is synced by any particular service. For all Hook knows, there could be two Hook instances running on the same Mac sharing the same sync folder; or there might be multiple folders synced through rsync or any other sync folder.

Hook does not sync preferences (such as sync folder paths). Its notion of syncing is merely

  1. writing link data to a particular folder,
  2. reading from that folder,
  3. merging link data from that folder

Hookā€™s Syncing only deals with links, it does not share the content of the Hook folder: notes, templates, Hook files. Iā€™ve updated the Sync Tab help page to make that clear.

The Notes directory can be anywhere on your Mac. And after a note file is created, you can move those files anywhere on your various Macs. So Hook notes are not ā€œownedā€ by Hook.

You can turn on the macOS iCloud preference to save the Desktop and Documents folder if you choose. (Many people donā€™t like it, however.)

one more thing: (as noted elsewhere on forum and doc) thereā€™s an issue right now such that if a Macbook is not plugged in, Hook sync will not run. (We set the priority of the Hook sync background process too low.) That will be fixed in the next release of Hook.

Thank you so much @LucB for your responses and information about Hook. While troubleshooting yesterday, I checked the hooksync folder in both machines and it seems they are identical (timestamp and number of files). I think I must have set things up incorrectly. I will troubleshoot further.

@LucB, in my situation, say I have a file called machine1.md which I stored at machine1 under /Volumes/Data/Dropbox/Document/ (which is a Dropbox folder). I linked this file machine1.md to a website using Hook. Activate my hooksync under /Volumes/Data/Dropbox/hooksync.

Then in machine 2, I have my dropbox folder under /Users/Zhao/Dropbox/Document/ (note different dropbox path here). So, I will get machine1.md synced automatically (since it was synced by Dropbox). And I think machine2 will get the links that I made in machine 1 under /Users/Zhao/Dropbox/hooksync.

So if I open machine1.md in machine 2, will Hook show me the website link that I made in machine1? I would expect it will but I am having difficulty making this works at the moment.

Is my understanding correct?

In principle, this should work with the caveats expressed in Using Hook with Dropbox ā€“ Hook. When a file is renamed or moved in Dropbox, on the local host, Dropbox actually moves the original file into one of its hidden directories and then creates a new file. If Dropbox does this while Hook is aware of a link to the moved file, it might not compensate for Dropboxā€™s move. So the website will end up pointing to a file in a Dropbox cache folder which Dropbox may purge at its will. If however the file was moved from one folder in Dropbox to another in Dropbox before Hook has tracked the file (e.g., Hook sync hasnā€™t been enabled on its side), then Hook should be able to attach the bidirectional link to the (presumably) desired file, based on its partial (terminal) path information, assuming the terminal file names are the same (which is what Hook would use as a heuristic in this case).

Weā€™re looking to add additional heuristics to Hook for Dropboxā€™s syncing idiosyncrasies.

Is there a way to extract the ā€œnon-hookā€ links to dropbox files in my finder? i mean the web links. The hook links donot seem to work for me, when i move the machines.

Hook canā€™t currently extract the Dropbox URL. I donā€™t think itā€™s possible. But we have an outstanding action to see if we can overcome the issues mentioned in Using Hook with Dropbox ā€“ Hook. Weā€™ll return to this. And hopefully Dropbox will provide an API at some point.

Another option for linking from Dropbox folders is to store Hook files in them Make Hook File ā€“ Hook (and you can store .hook files to Dropbox files/folders.) This is similar to what one can do to share links with other people in Dropbox or a version control system (VCS). Here, we often create a ā€œhookā€ folder in shared and VCS folders.

Bumping this up

Can you clarify the current status of syncing multiple computers using Hook?

Using either native Hook features and/or Dropbox and/or Hazel, is it possible to have both Hook links and .Hook files automatically sync among multiple computers?

(I suspect you may suggest symlinks and I really would prefer to avoid those as they are non-obvious if I need to re-create the setup in the future.)

We describe it here: Using Hook on Multiple Macs ā€“ Hook and Sync Tab ā€“ Hookmark .

Basically, if you turn on Sync, then your bookmarks will be synced between Macs (and soon: iOS , iPad devices).

Not at the moment. However, we do not feel there is a big need for that at the moment. A major feature of .hook files is that they can be stored anywhere, and they work in cloud synced folders. You can us any service you want: iCloud, Dropbox, DEVONthink, whatever. Often, we ourselves even put them in revision control systems (for our internal documentation). You can make the default Hook to New go to any folder you want, and have that synced with your service of choice. Later, Hook to New will have an option to create a file ā€˜in placeā€™, like aliases.

Having said that, when we add a foreground mode to Hook (soon), at that point it may make sense to enable Hook iCloud document sync.

I wasnā€™t going to. the only advantage of symlinks is that you can use them from the command line. (One could write a CLI script resolve the URL in the hook file.)

1 Like

Thanks

Syncing bookmarks is straightforward

.hook files is a bit less clear with multiple Macs. I think you are suggesting to use Hazel or similar to automate the process of moving .hook files from the default location to a Dropbox folder or similar and then doing that same setup on each Mac. Then add that Dropbox folder as a Global watched folder?

I thought your symlinks reference was to something else, but now I think you were referring to setting symlinks from the Hook files folder to somewhere else. Yes, that is what I would recommend for most people. Having said that if all goes well in Hook 3.2 users will be able to choose the location for the entire top level Hook folder. So that could go in a cloud share if that is what one wants.

Re Hazel, IMO it is a pretty good app for dealing with lots of files that need to be moved. I intend to write about that in the future. (I imagine many people are already using Hazel to move .hook files around, and also files created via Hook to New, as one might want different .hook files to be moved to different folders, and different Hook to New-created files to go to different folders. )

1 Like

Just to clarify:
Hooksync needs a consistent directory structure to sync?

If yes:

  • why not use the spotlight search index to find identical files that have moved or renamed by hash

If no:

  • does Hooksync achieve this by using the built in search directory that spotlight uses?

Hookā€™s syncing of bookmarks (links) works like this: Hook writes to a folder of your choice. Hook completely controls that folder and users should not touch it. In Hook 3.2 we will add a new option: iCloud sync, where you do not choose the folder. Either way, the question of consistent folder structure is opaque to the user. Itā€™s an implementation detail, similar to you not needing to concern yourself about what is in an appā€™s ~/Library/Application\ Support/

As for syncing .hook files: how you do it is up to you. That is opaque to Hook. Hook does not have a preference. Everyone has their own needs.

Compare BBEdit. If youā€™re using BBEdit, BBEdit should not care how you organize your files. It really depends on your needs.

Sorry I am not following you.