Syncing Macros Between Macs

From Keyboard Maestro Wiki
Jump to: navigation, search

Keyboard Maestro does not (yet) have syncing built in, and it is quite tricky to sync macros between Macs.

The macros are stored in the ~/Library/Application Support/Keyboard Maestro/Keyboard Maestro Macros.plist file, and this is the file you need to sync.

The Keyboard Maestro Engine will not read the file if it changes unless it is told to do so by Keyboard Maestro, or unless you use the AppleScript command:

tell application "Keyboard Maestro Engine" to reload

The Keyboard Maestro editor will never read the file except on launch.

So to sync the macros file you must ensure the Keyboard Maestro editor is not running on the target Mac, and you must explicitly ask the target engine to reload the macros after the sync.

One way to accomplish this would be to have a macro that triggered when Keyboard Maestro quit, which copied the Keyboard Maestro Macros.plist file to your DropBox folder, and another macro which quit the Keyboard Maestro editor, copied the Keyboard Maestro Macros.plist file from the DropBox folder to the ~/Application Support/Keyboard Maestro folder and asked the Keyboard Maestro Engine to reload the macros. This latter could run on wake, periodically, or manually, or you could organise the macro to fire when the file changes on disk, although that is not a trigger you can do within Keyboard Maestro currently, so you'd have to use a folder action or other AppleScript to trigger the macro.

An alternative to syncing is to export new macros and import them into the other Mac. If you make changes to a macro and export it, remember that you'll need to delete the corresponding macro on the target Mac before (or after) importing the new macro (before is better as it'll be confusing having both of them there).

Some users have found that the system is leaving behind files named like .dat0123.002 in the Keyboard Maestro folder. These appeared to be copies of files Keyboard Maestro saves, and we suspect they are not deleted as they should be for some reason (possibly Time Machine backups happen at the instant of their existence). They can, and should be deleted if you intend to sync the whole ~/Application Support/Keyboard Maestro folder, which you can do with a shell script like:

rm ~/"Library/Application Support/Keyboard Maestro"/.dat*.0*

run periodically or before the sync.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox