On macOS Tahoe 26 activating GUI apps from command-line often fails. It launches the app but not brings to the foreground as expected.
For example, running the following commands in Terminal is expected to launch Pages and bring it to the foreground.
open /Applications/Pages.app
or
osascript -e `tell application "Pages" to activate`
Moreover, they sometimes not return in Terminal.
These commands worked as expected until macOS 15 but no more in macOS 26.
The tricky part is that this failure doesn't happen 100% of the time; it occurs randomly. However, since multiple users of my app have reported the same symptoms, and I can reproduce it not only with my app but also with apps bundled to macOS, I don't believe this is an issue specific to my environment alone.
I’ve already filed this issue: FB21087054
- Open version: https://github.com/1024jp/AppleFeedback/issues/87
However, I’d like to know if any workaround exists or my understanding is wrong, especially for case with osascript.
I’ve already filed this issue: FB21087054
Thanks. That’s definitely the best path forward for this.
It’s hard to think of a way to work around given that a) none of your code is running, and b) it affects system apps.
This is likely fallout from a general effort to stop apps stealing focus from other apps. Check out the yieldActivation(toApplicationWithBundleIdentifier:) and other related method for more background on that. However, Terminal is the frontmost app, and it should be the responsible code for any command-line tools that you run, so I would expect this to work. And it does work most of the time, hence my comment that a bug report was the best path here.
If you’re able to reproduce not-returning case, a sysdiagnose log from that might yield a useful insight.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"