About once a week, my application-specific macros stop working for an application. Tonight it happened for the two macros I created for Keyboard Maestro itself.
When I select the application Group, the right panel shows "Available in these applications: [app-name]" as expected. However, when I Edit that Group and view the popup list of applications, the app-name appears twice in the list. I've attached a screenshot of two "Keyboard Maestro" applications.
When I select the unchecked app-name, and then redisplay the popup list, the "ghost" app is gone, and the macros are again working with the app.
I've verified there's only one copy of the app on my startup drive.
This happens when the macros reference an application at one path, and the application is found locally at a different path.
It can happen when you have two copies of the application on your Mac; when you have moved or renamed an application; or when you are syncing macros with a different Mac which has the application at a different location.
The fact that this is happens to be happening with the Keyboard Maestro application is just a coincidence, it could happen equally to any application that has two locations.
In my original post, I mentioned "I've verified there's only one copy of the app on my startup drive." However, I have an external HD that's a clone of the startup drive (updated every morning at 6:00 am by SuperDuper!). The clone HD has a different volume name; so the path to the duplicate application is different.
I'm puzzled by two aspects of this problem:
Why is Keyboard Maestro just occasionally connecting a macro Group with what I'm calling a "ghost" application?
I've been using Keyboard Maestro since 2011. Why did this problem show up just a month or two ago? Could it be due to a long-overdue upgrade from High Sierra to Monterey?
As I wrote #2, it occurred to me the switch from HFS to APFS may be a clue. The recent "ghost" apps have been 3rd party apps which I did not install in the macOS Applications folder. I have a practice of reserving the Applications folder for Apple's apps + apps that insist on being there. My hundreds of 3rd party apps were in a "3rd party apps" folder at the root of the startup drive. Monterey forced me to relocate that folder into the Shared folder.
When Keyboard Maestro loads the macros, and finds an entry referencing an application, it looks for the application at the path specified. If its found, then nothing happens, and that is the application referenced. If it is not found, then it will go looking for the application elsewhere, find one (more or less kind of at random, sometimes the latest version, but its up to the system and not entirely that simple), and record that as the new location.
So generally you wont have problems if there is no macro syncing, and the application always exists at the location originally found.
The application path could change if there are changes to the volume (eg the volume name tends to revert back to "Macintosh HD" on system migrations).
If you want to know the two paths, you can export the XML for the macro/macro group before and after resetting the application and see the change to the path.