Secure Keyboard Entry
Also: Secure Event Input, secure input
Published
Definition
Secure Keyboard Entry is a Terminal setting on a Mac that prevents other apps on your computer or the network from detecting and recording what you type in Terminal. It is built on a macOS mechanism called Secure Event Input, which stops keystrokes from being passed to any process that intercepts the keyboard.
You meet this setting in two ways. Either you turn it on yourself because you type passwords into a terminal, or you find out about it because a keyboard shortcut, a text expander or a push-to-talk key has stopped responding and you are trying to work out why.
The protection and the side effect are the same thing. macOS cannot tell a helpful tool that watches the keyboard from a harmful one, so while secure input is on, none of them receive your keys.
How to turn on Secure Keyboard Entry in Terminal
The setting is a single menu item in Apple’s Terminal app. Apple gives one warning before you use it: make sure other apps do not require keystrokes from Terminal.
- Open the Terminal app on your Mac.
- Click Terminal in the menu bar.
- Choose Secure Keyboard Entry.
- Open the Terminal menu again and confirm that a checkmark appears next to Secure Keyboard Entry. The checkmark means it is on.
How to turn off Secure Keyboard Entry
If your shortcuts or text snippets stopped working after you opened a terminal, check this menu item first. The same item switches the setting on and off.
- Bring Terminal to the front.
- Click Terminal in the menu bar.
- If Secure Keyboard Entry has a checkmark, choose it once to remove the checkmark.
- If you use iTerm2, click iTerm2 in the menu bar and choose Secure Keyboard Entry there instead. That menu item is iTerm2's own.
- Switch to another app and try the shortcut or snippet that had stopped working.
What is Secure Event Input?
Secure Event Input is the system mechanism underneath the menu item. Apple’s developer note on it, Technical Note TN2150, says the function was added in Mac OS X 10.3 to protect keyboard entry so that keyboard events cannot be intercepted by a keyboard intercept process. That note is from 2007 and sits in Apple’s documentation archive, but it is still Apple’s own explanation of the behavior.
Apps do not need a menu item to use it. Apple’s note says standard password fields secure keyboard events only when necessary, which means while you are typing in the field. Secure Keyboard Entry in a terminal is different because you choose to leave the protection on for ordinary typing.
Why do keyboard shortcuts and text expanders stop working?
Tools that react to keys while another app is in front have to watch the keyboard. Apple’s note lists the ways a process can do that, including an event tap, and names macros, accessibility tools and keyboard customizers as useful examples. A text expander, a global hotkey and a hold-to-talk key all fall in that group.
The note then states the rule: the system stops passing keyboard events to any intercept process whenever any process has enabled secure event input, whether that process is in the foreground or the background. So an app that leaves secure input on can silence keyboard tools across the whole Mac, not just inside its own window. Apple tells developers to enable it only when needed and to disable it when focus moves away.
- Text expansion: the tool never sees the abbreviation you typed, so nothing expands.
- Global shortcuts: a shortcut that another app listens for does nothing.
- Push-to-talk keys: a tool waiting for a key press or release does not see it.
- Key remappers and macro tools: they do not receive the keys they are meant to change or replay.
Secure Keyboard Entry in iTerm2
iTerm2 is a separate terminal app, not an Apple product, and it has its own switch under iTerm2 → Secure Keyboard Entry. iTerm2's documentation says that when it is enabled the operating system prevents other programs on your computer from seeing what you type, and that it may disable global hotkeys in other programs.
iTerm2's FAQ lists two more effects of its setting. When you use the open command, the app’s window may not come to the foreground, which the FAQ describes as a macOS security feature that prevents an app from stealing keyboard focus while you enter sensitive text. It also names scrolling problems with a Logitech mouse. In both cases the FAQ says to turn off iTerm2 → Secure Keyboard Entry.
Is Secure Keyboard Entry worth leaving on?
It depends on what you type in a terminal and which tools you rely on. If you often type passwords or secrets at a prompt and do not use keyboard tools, leaving it on costs you nothing. If you depend on a text expander, a launcher shortcut or a dictation key, you will lose them whenever it is on.
It is also not the only protection you have. macOS asks for your permission before an app can monitor the keyboard, and you can review that list under System Settings → Privacy & Security → Input Monitoring. Removing apps you do not trust from that list protects every app, not just the terminal.
Questions people ask.
What does Secure Keyboard Entry do in Terminal?
Apple says it can prevent other apps on your computer or the network from detecting and recording what you type in Terminal. You turn it on by choosing Terminal → Secure Keyboard Entry, and a checkmark shows that it is on.
How do I turn off Secure Keyboard Entry on a Mac?
Open Terminal, click Terminal in the menu bar, and choose Secure Keyboard Entry so the checkmark disappears. In iTerm2 the item is under the iTerm2 menu.
Why did my text expander stop working on my Mac?
One common cause is secure input. While any app has Secure Event Input enabled, macOS stops passing keystrokes to tools that watch the keyboard, so the expander never sees what you typed. Check Secure Keyboard Entry in your terminal app and click out of any password field.
Why do my global hotkeys not work when Terminal or iTerm2 is open?
Secure Keyboard Entry is probably turned on. iTerm2's documentation says its setting may disable global hotkeys in other programs, and Apple warns you to make sure other apps do not require keystrokes from Terminal before you turn it on.
Is Secure Event Input the same as Secure Keyboard Entry?
Secure Event Input is the macOS mechanism that hides keystrokes from keyboard intercept processes. Secure Keyboard Entry is the menu item in Terminal, and separately in iTerm2, that keeps that protection on while you type in the terminal.
Do password fields turn on secure input?
Yes. Apple’s developer note says the standard password fields secure keyboard events only when necessary, so the protection applies while you are typing in the field. If a keyboard tool stops responding, click out of the password field and try again.