MACRO: MacroBackerUpper—it's like Time Machine for your macro library

I'm working on a 2.1 update for a number of these issues that have come up (most resolved now, hooray). However, I'm not quite sure when it'll be done. In the interim, thanks to some users' reports, I found one fairly bad bug: The macro will fail if you rename a macro or group.

That's due to me missing two parameters while editing the many calls to my SQL processing subroutine. If you'd like to make 2.0 work right while I get 2.1 ready, just replace tasks | 02 Analyze moves and renames in the 2.0 macro with the attached version.

IMPORTANT This will go into a "2.1" version macro group. Just move it into the 2.0 macro, replacing the one that's there.

tasks | 02 Analyze moves and renames.kmmacros (61 KB)

The macro should now work even with renamed groups or macros. Sorry about that! (I had to edit about 100 SQL subroutine calls to add the database name parameter when I created the Settings database, and I missed these two.)



And 2.1 is out—if you have an older version, run the Update Check macro to download it, or just download from the link in the first post here. I found and fixed the two areas that were crashing the macro (hooray!), simplified the new user experience, and cleaned up some other stuff…

2.1 full release notes
  • New users have to answer only two questions to start: Backup folder name and location. The other settings are now optional on first run, which should greatly simplify the new user experience.

  • Fixed a mistake on my part that would cause the macro to fail if you renamed any macros or groups. (Long story short: I missed adding a new parameter to two calls to my SQL-handling subroutine that are needed to identify which database to work with.)

  • And fixed a similar mistake if you had groups named with a leading dot—they too would cause the macro to fail.

  • I misunderstood the %Trigger% token, and have now switched to the more-useful %TriggerBase% token. Translated to understandable, that means that if you've set the macro to only see the onscreen progress and summary dialogs when manually triggered, well, that should work now.

  • Fixed a bug that prevented the setting for the "macro done" notice (notification, window, or none) from working.

  • Fixed a problem with the Settings Manager where it didn't really quit when reloading, leaving some variables in a state that would then trigger some of the error trapping.

  • Corrected an incorrect find command in the step that verifies the backup folder was correctly named.

  • Removed a duplicate call to the First Run macro—thankfully, its macro reference was blank, so it wouldn't actually do anything.

  • Modified the (red text) warning in the First Run macro to make it clear it applies to those who have run older versions of the macro.

My thanks to everyone who reported issues and worked with me to help resolve them. MBU is, by far, the most complex macro I've ever written—it encompasses 1,233 separate actions spread across 26 macros, two separate databases, hundreds of SQL calls, and quite a few little Perl and shell scripts doing yeoman's work in the background. I'm thrilled with how it turned out, but that doesn't mean it came out perfect :).

(Thanks to ccstone's Count Actions in Selected Macro JXA 1.0.2 for making it reasonably easy to count all the actions in this macro!)

I try to test well on my Mac, but there are limits to both my time and ability—so your feedback has been invaluable in helping find and fix these issues when they occur.



I found a mistake in the SQL routine I use to access and write the database files—I forgot to disable "trim" on the shell script action. This may affect certain space-as-first-character macros in a backup, depending on what else changed.

If you're using 2.1, please download it again from the link in the first post. Rename the current macro group as "2.1 old" or whatever, then install, activate, and run 2.1, and it should "just work." If it doesn't, please let me know—it worked fine here on two Macs, and the only change was disabling that "trim" option for that SQL-related shell script.


I followed the instructions and got errors - resulting in the BU failing.

Here are the errors.


with the corresponding action:


with the corresponding action:

At the end the progress window was left onscreen like this:


What is this tool that you're using to browse the engine log? I like it a lot.

It's @_jims macro:

My go-to error reporter!!

1 Like

I'm going to move this to direct messages, as I feel it could take a bit to figure out what's going on. It runs fine here on two separate Macs, OSes, and KM versions.


1 Like

I am also suddenly getting a bad result and failing at the same spot.

I renamed the old group "old," downloaded 2.1, and this is the error log:


2023-11-24 10:58:38 Execute macro “•main | MacroBackerUpper” from trigger Editor
2023-11-24 10:58:39 GetProcessForPID(5087) failed with -600 for <KBMRunningApplication “Keyboard Maestro” <0x600002101550> pid=5087 bid=com.stairways.keyboardmaestro.editor Abht>, using cached version
2023-11-24 10:58:42 Action 15404276 failed: Delete File action failed because source does not exists /Users/christian/Library/CloudStorage/Dropbox/apps/Keyboard Maestro/KM Backups (MBU)/__latest
2023-11-24 10:59:02 Action 15404266 failed: Execute a Shell Script failed with script error: Parse error near line 2: no such table: macros_new
2023-11-24 10:59:02 Execute a Shell Script failed with script error: Parse error near line 2: no such table: macros_new. Macro “•main | MacroBackerUpper” cancelled (while executing Execute Shell Script).

Ah, found it! So sorry for the hassles, I had a single letter typo in a routine that I never called in my testing, and which clearly got called by those having issues. I'l update the first post above, but try this version:

__ MacroBackerUpper 2.1 Macros.kmmacros (1.1 MB)

That one absolutely, positively, should work…I hope :).


Working great for me! Thanks again.

Version 2.2 is out. The big news is the ability to access a visual diff tool, at least for macros that are in the same group and have the same name as in the last backup. An onscreen picker shows you the modified macros from the last backup:

Pick one, and it will open in one of three different visual comparison apps:

There are no settings for this: The macro will try to use FileMerge first (that's in the screenshot above), but that requires a full Xcode install. If that's not there, it will usual Visual Studio Code; if that's also not there, then it falls back to the built-in diff output. If there's demand, I can add settings to control it, and possibly support other tools, if there's one you'd prefer to use.

The delay box has also gained some new skills:

There was as bunch of little stuff, as always; full release notes hiding below. You can download the latest with the link in the first post, or using the in-macro "check for update" macro.

Full release notes
  • New: A standalone macro in •main, named 'Compare modified macros,' lets you do just that: For any modified macro with the same name and parent group as in the prior backup, you can see the actual diff of the two files. You can run this macro at any time, it's not part of the main macro. (This is true of all four macros in •main.) See the comment box in the macro for more on how it works. It can also be run from the delay-to-start box.

  • New: Added a macro update check option to the delay-to-start box.

  • New: Added a cancel macro option to the delay-to-start box.

  • New: The Settings Manager settings screens have all been rewritten. They're now all aware of the current setting, and only present options that make choice relative to that setting.

  • Found and fixed three calls to the SQL subroutine that weren't properly formed after the 2.0 conversion.

  • Fixed a bug in the SQL routine that would cause space-named groups and macros to possibly not match their counterparts, as the shell script was set to trim output. Dangit, thought I caught all of those!

  • Added protection in hard link creation routines so new files aren't removed unless the old file is confirmed to exist first.

  • Changed the header for the IDENTICAL macro groups section of the report—I added (UNCHANGED) to clarify these are unchanged since the last backup.

  • Revised structure of the initial setup macro to eliminate a needless if/then.

  • Modified the Settings Manager macro so it can't be run on its own—it was never designed to do that, and certain variables don't get set when you do, and then it fails.

  • Added some (off by default) debugging info in the SQL subroutine, so if a user has an issue, I can get better information regarding what's going wrong.

  • Optimized some of the database calls for a (slight) speed improvement.



Hi, @griffman. Thanks for your continued hard work on this incredibly useful backup utility. I love the additional features you've added to v2.2.


Thanks, and thanks for all the testing help!


Just a heads up: If you use Default Folder X, it will interfere with MacroBackerUpper's ability to save the backup in the right location. I found that out this morning after helping a user troubleshoot the macro on their Mac.

For now, you should disable Default Folder X within Keyboard Maestro if you want to use MacroBackerUpper. I've added a to do to get their demo at some point and see if I can make MBU work when Default Folder X is active.


Version 2.3 is out, and it's mainly a cautionary release: First, use Default Folder X's settings to disable it when Keyboard Maestro is active, and the restart Keyboard Maestro—it interferes with the process I use to set the export folder location. I plan to get the trial version of Default Folder X and see if I can work with it, but for now, it's best to disable it.

The second caution is that if you have macros and/or groups whose names include ###, then MBU is likely to have issues. This happens to be the string I chose to use as a delimiter when working with data that goes to and from the database, and finding the delimiter in unexpected spots will probably cause issues. In the next version of MBU, I'll change my delimiter to something more obscure, but I don't want to rush that change out, as the use of the delimiter is extensive, and I need to make sure I find and change them all.

There are also some fixes in here, mainly related to analyzing and writing modified macros when there aren't any…turns out writing them doesn't work so well if they're blank.

Full release notes
  • Caution: If you use Default Folder X, it will probably prevent MacroBackerUpper from successfully exporting its backups. For now, the solution is to disable Default Folder X within Keyboard Maestro.

  • Caution: If any of your group or macro names contain ###, you will probably have issues with the macro. I chose that string as the delimiter to use in all database operations, and things will not parse correctly if it's found in your naming scheme. A future update will change my delimiter to something much more obscure.

  • Added code to make sure the Command key won't work in the delay box if there are no modified macros to examine.

  • Fixed a mistake that prevented the creation of (backup) UUID files on the first run by a new user.

  • Added a check to make sure there are modified macros before updating database.

  • Added a check to make sure there are modified macros before writing to the "modifieds" file.

  • Changed the code related to replacing entire directories with hard links to account for dot-named files. Related: TIL that the * shell wildcard won't affect filenames that begin with a dot.

As always, you can install from the first post in this thread, or by checking for updates from within the macro.



Version 2.4 is out, with the promised change to the delimiter—you can return to using ### in your names, but please, do not use ←🔸→ … seriously, don't. You will break all sorts of things :).

The other news is that I figured out a way around the Default Folder X problem. Users of Default Folder X can leave it enabled in Keyboard Maestro; the macro will disable it to run the backup, then re-enable it. This is what happens when developers include good AppleScript support in their apps, so thank you, St. Clair Software!

If you are a user of Default Folder X, you will see this dialog the first time you run version 2.4:

Please say OK to that dialog! You will only see it one time, and if you say Don't Allow, MBU won't be able to disable Default Folder X, and the macro will have issues.

There was one very minor bug fix, too, but that's it—full release notes below.

2.4 Release Notes
  • Users of Default Folder X, rejoice! You can now use MacroBackerUpper without making any changes to your Default Folder X settings: MBU will disable Default Folder X until the backup is completed. Thank you, St. Clair Software, for the very nice AppleScript support!

  • Changed the delimiter used (behind the scenes) for all database interactions. It used to be ###, but there are at least two people out there who use that in their macro or group names. So now it's ←🔸→ … and if any of you are using that trio in your naming…well, I'm sorry, but you can't use MBU until you rename those macros and groups :).

  • Fixed a bug that was causing the total disk space value to not show in the summary dialog at the end of a run.

Current users can use the update check to download the new macro, or download from the first link in this thread.

This version was tested by my ever-vigilant group of testers (thanks so much!), and it worked well for them, so I'm not expecting any issues. But if you have any, of course, let me know!


And 2.5 is out now, linked in the first post above, or if you have MBU installed, run the Check for Updates macro. I had to change how it looked for Default Folder X, as those using DFX through SetApp weren't detected by Keyboard Maestro's "is application active?" action. No other real changes, just some cleanup of no-longer-needed large instance variables.


1 Like

And 2.6 is out now, with a bug fix and a behavior change (thanks to @_jims for both of those!), and a couple other minor changes.

Full release notes for 2.6
  • Added a Trim filter action to the sample dot-named group to remove a line break.

  • The update checking macro won't notify you that you're already up to date if it runs on its periodic timer. If you run it manually, you will see a notification.

  • Undid a change made in 2.2 that removed a supposedly unneeded if-then statement in Setup. Turns out it was needed after all (in cases where the backup folder goes missing but the backup location variable is set).

  • Updated the macro tracking action for those who use my Macro Usage Counter macro.

The 2.6 download is linked in the first post, or just check for updates from within the macro to download it directly.



That's not a "macro", that's an APP!

Well, it doesn't actually do the updating for you, just alerts the new version's existence and downloads it from my site. But it does mean users don't have to check the forum for newer versions.

It's not overly complicated; I wrote it up a couple years back:

I do use two servers to try to add some file integrity protection: The downloads come from my server, but then they're verified using SHASUM values downloaded from a different server. I've been pretty happy with how well it's worked for me.