Paste Text not working in Terminal

I can’t figure out why my Paste Text macro works everywhere but in Terminal. Here’s a quick screencast to show the issue: Uploading…


Hey There,

Your vid did not upload.

The best way to handle vids is to post a link to them from a host like dropbox or YouTube.


Huh, I'd turned into a .gif (since it was only 6 seconds long), wonder why it didn't upload. In any event, here's a YouTube version:

No idea. I'll look more when I'm back on the computer. I'm on my iPad right now.

I'm just guessing but it looks like the terminal is not available to your macro.

Is your macro actually global or is it app specific?

Or could you have excluded the terminal from your macro group?


It’s global. When I was trying to troubleshoot, I moved the macro into a Terminal-only group but it didn’t work there either :confused:

Well darn.

I suppose the best thing to do is for you to post the macro itself for us to test.

To post a macro use the share menu in the Keyboard Maestro editor.

That will create a new topic, and you can take that and cut and paste it into the topic that’s relevant.

There’s a section on how to do that in the wiki.

I’d give you better instructions, but I’m on the iPad right now I and away from the computer.


Keyboard Maestro “YouTube-DL” Macro

YouTube-DL.kmmacros (1.4 KB)


I tried your macro, and it worked perfectly in the Terminal on my machine.

So – what could be different about your system?

Have you tried making a different but similar macro.

Have you tried Insert Text by Typing instead of Insert Text by Pasting just to see what happens?


Yeah, this is an odd one. I tried both Insert by Typing and Pasting. Tried making brand-new macros (both Global and Terminal-only). Logged out/in. Terminal just doesn't want to play along anymore. I use KM extensively and haven't seen this glitch before.

Odder still: I have another, older macro (created a few months ago, maybe) that inserts by pasting in Terminal, and it still works. Seems to be only newly-created ones that don't work.


One last idea. Do a “Find in All Macros” search for your trigger text, and see what comes up.


Search for:

<your-trigger-text> trigger:typed string


The search returns the macro, as expected. When I make it Global and run it in TextEdit (for example), the engine.log shows that it was run. When I try it in Terminal, no entry is logged.

A real mystery. I’m gonna move on for the time being, but thank you so much for your time and efforts. I can add the command to my bash profile and call it from there.

Try disabling your old Terminal group and making a new Terminal group.

Place your macro in there.

Or you could change the existing group from Terminal to something else and then back again.

You know how to make a function that takes parameters?


In Terminal, check your Terminal menu. You probably have enabled (accidentally or intentionally) Secure Keyboard Input which behaves as if you are in a password field. Specifically, Keyboard Maestro cannot see the keys you are typing and therefore the Typed String triggers will not work.

1 Like

Yup, that was it. Thanks!

Curious then as to why my other macro (which includes an Insert Text by Pasting action) was running without issue? I use this macro to automatically type 'exit' into Terminal when I go to quit to ensure that I get a nice 'clean' end to my Terminal sessions.

Quit-Exit.kmmacros (23 KB)

Secure Keyboard Input disables the Typed String triggers.

The macro itself works fine, the Insert Text works fine (by Typing or Pasting).

It is only the Typed String trigger that cannot work.

Well, technically there is another case you’ll see in situations where your hot key trigger uses the same key as the a key you typed with Insert Text by Typing. This is because Keyboard Maestro cannot see that you have pressed the key (because of the Secure Keyboard Input) and therefore does not know to simulate releasing it before typing it (see the wiki troubleshooting page for details).

Ah, I see (you said that earlier, I didn't read closely enough!). This is great to know.