Skip to content

FB21087054: open command occasionally fails to bring applications to the foreground #87

@1024jp

Description

@1024jp

Since updating to macOS 26, launching GUI applications from the command line has become unreliable.
When launching an app with the open command, for example:

open /Applications/Pages.app

the application launches but often remains in the background instead of coming to the foreground.

Similarly, when launching an app via osascript (AppleScript), for example:

osascript -e `tell application "Pages" to activate`

the application frequently fails to come to the foreground as well.

In addition, these commands sometimes do not return at all, and the application is never activated.

This issue does not occur 100% of the time but appears intermittently, making it difficult to determine exact reproduction conditions. However, it occurs consistently enough to affect usability.

Steps to reproduce

In the following steps, I use the bundled TextEdit.app as an example.
However, the same issue occurs with other applications as well.

  1. Launch Terminal.
  2. Run the following line in Terminal: open /System/Applications/TextEdit.app.
  3. -> TextEdit does not come to the foreground.
  4. Run the following line in Terminal again: open /System/Applications/TextEdit.app.
  5. -> This time TextEdit launches and comes to the foreground properly.

Again, note that this issue occurs intermittently.

I have observed that the failure happens more often on the first launch attempt and succeeds on a second attempt, which is why I included both attempts in the reproduction steps.
However, it is unclear whether this ordering is required for the issue to reproduce.

A screen recording demonstrating this issue is attached. (I was not able to capture a case where the command fails to return.)
In the recording, the first open command and the first osascript invocation fail to bring the app to the foreground, while the second open command activates it successfully.

Expected results

Launching a standard GUI application from the command-line (via open or osascript) should reliably launch the application and bring it to the foreground when requested.

Actual results

Launching a standard GUI application from the command line occasionally fails to bring it to the foreground, and in some cases the command does not return.

Environment

  • macOS: Version 26.2 Beta 3 (25C5048a)
  • Xcode: Version 26.1.1 (17B100)

I also received a report from a user stating that the same issue occurs on macOS 15.

Impact to my customers

This issue prevents users from launching CotEditor via the command-line.
CotEditor includes a command-line tool implemented in python3 and uses AppleScript (osascript) to communicate with the main application (CotEditor.app).
This worked correctly through the macOS 15 era.

However, after either building the app with the macOS 26 SDK or running on macOS 26, the command-line tool occasionally fails with the following error:

subprocess.CalledProcessError: Command 'tell app "/Applications/CotEditor.app" to open POSIX file "/Users/imanishi/test.txt"' returned non-zero exit status 1.

Additionally, some users prefer to launch applications or open files using the system’s standard open command, as described above, instead of using the bundled cot command.
Since CotEditor is a plain-text editor, many users open text files from the command line, so this bug directly affects their workflow.

Related discussions in the CotEditor issue tracker:

Attachments

Screen.Recording.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmacOSrespondedFeedback that have received responses from Apple

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions