15

Has anyone encountered an issue in which Terminal.app is no longer able to switch focus to another application?

For example, typing in the command open . would have previously opened the current folder in Finder, and then switch focus to Finder (i.e. bring Finder to foreground). However, that no longer works, and no options/etc. seem to fix it.

Similar results with applications (e.g. open /Applications/Safari.app/) and URLs (e.g. open http://www.google.com/). The requested action takes place, but the OS' focus stays on Terminal.app.

Terminal.app has full Accessibility permissions, so that's not it.

Anyone else run into this and/or found a solution?

Running MacOS Monterey (12.0) on Apple Silicon.

1 Answer 1

29

A ha! I figured it out.

Seems that the "Secure Keyboard Entry" option was the culprit. Turning it off fixed the "problem." Turning it on reliably reproduces it.

Seems like that might be a feature and not a bug...

6
  • It is a feature. There have been several instances where I've been typing away, only to have another application suddenly grab focus, resulting in my keystrokes doing something I didn't intend them to do.
    – chepner
    Commented Nov 19, 2021 at 21:29
  • 3
    "Secure Keyboard Entry" is a specific tool to protect password entry and similar activities, it's not a thing you generally need or want. Commented Nov 20, 2021 at 1:09
  • 1
    Wish I could upvote this answer more than once. Just spent 3 hours trying to figure out why launching my game from iTerm2 would unfocus it and place it last in the cmd+tab list. Tried upgrading GLFW and all sorts of NSApp and NSWindow schenanigans. Turning off Secure Keyboard Entry worked like a charm. Commented Sep 21, 2022 at 20:03
  • For iTerm: apple.stackexchange.com/questions/70609/… Commented Dec 14, 2022 at 19:42
  • 2
    Thank you!! This was driving me insane. For anyone else that needs to disable this for Iterm2, the option is in the "Iterm2" menu dropdown.
    – btse
    Commented Feb 1, 2023 at 19:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .