One Approach to Synchronize All Macros Between Multiple Macs


I've developed a method synchronize all the Keyboard Maestro macros between three Mac computers, three unique models running different versions of macOS. Keyboard Maestro v10.2 is installed on all three. (Three cheers to @peternlewis for his support of older versions of macOS!)

Here's a summary of my current implementation:

  1. I have one computer that I consider my Master computer, a MacBook Pro (Ventura 13.5.1 (22G90)/MacBookPro16,1).

  2. I have two computers that I consider Slave computers, a Mac mini (Mojave 10.14.16/Macmini6,2) and an iMac (High Sierra 10.13.6/iMac11,1445).

  3. I do the majority of my Keyboard Maestro development on the Master.

  4. On the Master and two Slaves, I've enabled Keyboard Maestro Syncing, but these are dedicated to the individual Macs, each housed on the local drive.

    ~/Documents/Automation/_Keyboard Maestro/_Sync and Save/Keyboard Maestro Macros.kmsync
    
  5. I have a single macro, named Save (Master) or Replace (Slave) Sync File, that triggers when the Keyboard Maestro application quits. It does the following:

    • Checks the computer name to determine if it is running on the Master or a Salve.

    • If running on the Master, the local sync file is copied to two locations, one local and one in the cloud. The first copy is also renamed using the date/time to permit multiple copies to be saved to the same archive folder. Note that these local archived copies will theoretically never be used. They just serve as backups if something goes awry.

      ~/Documents/Automation/_Keyboard Maestro/_Sync and Save/Archive/2023-09-17-1339_Keyboard Maestro Macros-MBPro.kmsync
      
      ~/Library/Mobile Documents/com~apple~CloudDocs/Keyboard Maestro/_Sync and Save/Keyboard Maestro Macros.kmsync
      
    • If running on the Slave, the local sync file is first renamed and copied.

      ~/Documents/Automation/_Keyboard Maestro/_Sync and Save/Archive/2023-09-17-1339_Keyboard Maestro Macros-i7.kmsync
      

      Second, the local sync file is replaced by copying the sync file that the Master copied to iCloud. Specifically on my mac mini Slave, the following sync file:

      ~/Documents/Automation/_Keyboard Maestro/_Sync and Save/Keyboard Maestro Macros.kmsync
      

      is replaced by a copy of this file:

      ~/Library/Mobile Documents/com~apple~CloudDocs/Keyboard Maestro/_Sync and Save/Keyboard Maestro Macros.kmsync
      

As mentioned above, I do most, but not all, macro development on my Master computer.

If I've done macro development on the Master that I want to replicate on the Slaves, I quit the Keyboard Maestro application on the Mac, wait for the macro Save (Master) or Replace (Slave) Sync File to complete. I then restart Keyboard Maestro on the Master. Next I move to each Slave and do the same: quit, wait for macro to complete, restart KM.

If I've done work on one of the Slaves that needs to replicated on the Master and and the other Slaves, then I hold the Shift key (⇧) down when quitting Keyboard Maestro. This presents a dialog and an opportunity to reverse the Master/Slave role.


Here's the aforementioned macro. Note that it does require a few steps of simple configuration.

Download: Save (Master) or Replace (Slave) Sync File.kmmacros (82 KB)

Macro-Image


Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.

System Information
  • macOS 13.5.2 (22G91)
  • Keyboard Maestro v10.2

1 Like

I've updated the OP macro, Save (Master) or Replace (Slave) Sync File, to Version 2.0:

  • If the Control key (⌃) is held down when Keyboard Maestro is quit, the created archive sync file will be revealed.

  • In the final Display Text action, added the archive folder.

  • Logs the following: '%ExecutingMacro%'; Created: %Variable%local_ASyncFilePath%

  • To keep clutter out of the Engine.log, checks for files before attempting to trash them.

  • Moved this macro to the Global Macro Group.

  • Fixed a few typos in the header comment.