KM 8.2.4: delay of 20 secs after trigger

KM 8.2.4 on Mojave is ridiculously slow on my Macbook Pro 2018 2.7GHz Core I7. I have a delay of 20 secs (!) after the trigger was fired (e.g. key press) until the action is eventually being executed.

See the following macro:

Unlock 1Password

Triggered by any of the following:

  • Volume “Access” is Mounted
  • The Hot Key ⇧⌘L is pressed

Will execute the following actions:

  • Activate 1Password 6
    • Reopen initial windows.
    • Notify on failure
  • Pause Until All Conditions Met
    • Menu with name “Lock” is not enabled
  • Pause for 1 Second
  • Set Variable “usbgpg” to Keychain Password “AccessUSB”
  • Execute Shell Script
    /usr/local/bin/gpg --batch --passphrase "$KMVAR_usbgpg" -d "/Volumes/Access/1pw.gpg" 2>/dev/null
    • Save trimmed results to variable “password”.
  • Insert Text by Typing
    %Variable%password%
  • Type the Return Keystroke

I hit the hot key and, OK, the app 1Password 6 is activated instantaneously. No delay there. But until the password is finally entered in order to unlock 1Password I have to wait 21 more seconds !!! And I cannot see what could cause that delay, the gpg decryption of the password is executed in zero time from the shell and the overall system load is extremely low.

So what is going on in this 21 seconds? What is KM waiting for? How could I debug this?

(Btw. I tested this with KM9.x, too, same effect).

My guess in this case is that it is not looking to Keyboard Maestro like 1Password has come to the front, and the Activate action is waiting for that to happen, and it never seems to happen, and then is timing out after 20 seconds.

I'm not sure why that would be, probably related to the weird shenanigans that 1Password does when it “quits”, switching itself from foreground to background-only.

You could use the Open action to Open the application, or even the shell script open -a "1Password 6". Or you could turn off any errors and reduce the timeout on the activate action.

Thanks for the info, but I don't think it's related to that. I have another macro that runs Applescript in Outlook, it's also extremely slow. It's supposed to move a mail into a folder triggered by a key press. It takes also 15sec or more.

I have no further suggestions. You'll have to try using Activity Monitor to get a sample of Keyboard Maestro Engine while it is frozen to see what it is stuck doing to have much hope of figuring out where the problem might lie.

@Stefan_Bogun, since Peter is out of ideas, I'll offer these:

There is clearly something running on your Mac, probably not associated with KM, that is causing this behavior that the rest of us do not see. While unlikely, it is also possible you have a corrupt file that KM uses.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EDIT: I just thought of another idea:

  • Disable all KM Macros except for the key Macro that is showing a delay
    • You can do this by moving the key Macro to a new Macro Group, and then disabling all other Macro Groups.
    • Now run the key macro and test
    • If it runs OK (no delays), then enable the other Macro Groups one-by-one and test.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So, if you have tried everything else, I would consider these steps:

  1. Restart you Mac in Safe mode
    • Then start KM Engine and test
    • If KM runs OK, then start other apps and/or utilities that you suspect could cause the problem. Start each one and then test.
    • Obviously if you start an app/util and the issue occurs, then you know the cause.
      .
  2. If still unresolved, then I'd do a CLEAN REINSTALL of KM as a LAST RESORT
    1. NOTE: ==This will remove all of your KM Macros, Variables, Clipboards, and other stored data==
      • So this should be a last resort step
      • Be sure to backup you KM data (the next two steps) BEFORE proceeding
    2. ==Export all of your KM Macros to a safe location==
    3. Make a backup copy of all the files (don't need folders) in ~/Library/Application Support/Keyboard Maestro
    4. Use an app uninstaller like AppDelete to uninstall KM and ALL related files.
      • This will ensure that you don't have any corrupted KM-related files
    5. Download a fresh copy of KM and install.
    6. Import your Macros from Step 2-2 above and Test.
      • If that fixes your issue, then make another backup of the files in Step 2-3, and one-by-one replace with the file from Step 2-3, and test. EXCEPT: Do NOT replace the master Macro file Keyboard Maestro Macros.plist, since that file contains the macros you just imported.
      • If after adding a file the issue returns you will then know what is causing the issue.

Usually Step 2 (Clean reinstall) is NOT required. But sometimes it is the solution. I have not had to use this with KM, but I have used it several times with other apps, like Evernote, which have many, many files associated with the app.

Good luck, and let us know how it goes.