Help: Major Data Loss When Opening Existing .kmsync File

Hello,

I ran into a major data loss and would like to know how to recover the lost data, if possible.

I had been using Dropbox as the syncing service for Keyboard Maestro before the accident for ~1y. Today, I renamed the folder containing the existing .kmsync file and wanted to point KM to the location of the renamed folder. I went to KM Preferences > General and saw that “Sync Macros” was disabled, which I assumed was because I renamed the parent folder without KM knowing, so I re-enabled the option and chose Open Existing… > Replace All Macros.

Upon loading the new .kmsync file, I was greeted with a much older version of my macro library, i.e. the number of macros were much smaller than it should be, with many new macros missing and some deleted / renamed macros still existing / using their old name.

I immediately went into Time Machine and browsed to yesterday’s snapshot of my local Dropbox folder. To my surprise, the version of the .kmsync file in the snapshot was identical to the current version, so I had no idea what to do next to recover my data.

I guess the reason is that KM has stopped writing new data into the .kmsync file in my local Dropbox folder for quite some time now, so the file is actually outdated without me noticing. If this is true, then which directory should I dive into in Time Machine to recover the version of my macro library that KM has been keeping up-to-date? Also, how do I identify how this whole situation even happened in the first place, whether it’s caused by a bug somewhere or something wrong I did, so that other users don’t have to experience the same horror story? Thanks in advance!

Additional info that may or may not be useful:

  • I started using Maestral instead of the official Dropbox app as the client some time ago, but I cannot tell if the outdated .kmsync file happens to be the version just before the switch. Edit: I’m pretty sure I started using Maestral after listening to MPU episode 616, which aired on Nov 29. The oldest Time Machine snapshot I have dates back to Nov 9, and the .kmsync file on Nov 9 is identical to the current version. So the sync file has been outdated since earlier than Nov 9 and Maestral is most likely innocent.
  • In the renamed Dropbox folder, I also kept Alfred’s sync file, Alfred.alfredpreferences. After renaming the folder first, I first loaded Alfred’s sync file, which was up-to-date and worked fine. Then I loaded KM’s sync file and ran into the issue.

Man that's awful! I'm always afraid that I might somehow nuke my macros :laughing: Without getting into they why it happened (because I'm unfamiliar with Maestral and also don't use Time Machine), you could restore your macro library using Keyboard Maestro's built-in revert option from the file menu.

1 Like

Hi @xurc,
Sorry to hear that.
In your TimeMachine, go to ~/Library/Application Support/Keyboard Maestro and look for Keyboard Maestro Macros.plist to see if you can find a most recent backup.

1 Like

Ah, I thought I’d have to dig into some obscure directories in Time Machine, but it’s actually so easy! Now I’m instantly back on my feet. Thank you (and of course, Peter!) for saving my bacon.

1 Like

You're welcome, glad it worked out for you and trust me... you’re not the first nor will you be the last to have to take advantage of this great feature :laughing:

1 Like

Hey @xurc,

Big mistake.

manual:Macro Syncing [Keyboard Maestro Wiki]

DON'T use the .kmsync file to revert macros...

You should be able to recover without too much trouble:

Keyboard Maestro Editor ⇢ File ⇢ Revert Macros

image

I have no idea why your .kmsync file is out of wack.

I recommend you do a search for “.kmsync” with a real file search utility – not Spotlight.

Finding Files on macOS

-Chris

2 Likes

Thanks for the help! I tested it out for the sake of it. Curiously enough, a couple of macros contained in the .plist file (i.e. I can search and find them using a text editor) are not shown in KM’s editor after restoring from Time Machine. It’s no big deal since I created them just today and can easily manually recreate them, but still a bit strange.

This is not entirely on topic, but it runs you through the process.

Temporarily revert to an older set of macros - #4 by JMichaelTX

Oh, it truly is a great feature! I never knew KM has built-in backups.

Hello Chris, thanks for the detailed explanation and so many tips! I do have EasyFind installed and just used it to search for “.kmsync”. The only search result is the sync file in my local Dropbox folder, which has now been updated by KM. Perhaps the “Sync Macros” button was turned off some time ago and KM has stopped writing to the sync file ever since, although I certainly don’t remember turning it off myself.

1 Like

Just remember that even EasyFind won't find everything if you don't start it at the root folder, and choose the right search options. Sounds obvious, right? Doesn't mean I didn't make that mistake about a month ago. :roll_eyes: :laughing:

2 Likes

It looks like you've solved your problem. But for future reference, as well as the inbuilt Keyboard Maestro version history, one of the perks of using Dropbox for syncing is that Dropbox also has versions. This is the way I've recovered from disasters in the past.

image

4 Likes

I just switched back to Dropbox after my third major iCloud Drive failure in a little over a year. Finally bit the bullet and got a premium account and while I hope I never have to use this feature it’s reassuring to know it’s there.

1 Like

Thanks for the reminder! I started the search at Macintosh HD and included “Package Contents” and “Invisible Files & Folders”. I don’t use EasyFind often, but I think that should cover everything, right?

Thanks for the tip! I did think of this option, but the file has been outdated since earlier than Nov 9th so even Time Machine couldn’t do anything. It certainly is nice to have another version history mechanism though!

Dropbox used to do Unlimited Version History for free. Now they've reduced that down to 30 days for paid and 180 days for the Business Account. It's still a really good feature. In fact for a (probably enormous) price they even offer a 10 year versions history...

EDIT - I've just checked my Dropbox and as I was an early adopter and paid for their "Rat Pack" option, I still have Unlimited Version History.

Unlimited version history is overkill for me, but for more serious users such as enterprise, it’s killer.