-
-
Notifications
You must be signed in to change notification settings - Fork 0
Description
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.appthe 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.
- Launch Terminal.
- Run the following line in Terminal:
open /System/Applications/TextEdit.app. - -> TextEdit does not come to the foreground.
- Run the following line in Terminal again:
open /System/Applications/TextEdit.app. - -> 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:
- Unable to open CotEditor from CLI? coteditor/CotEditor#1979
- macOS 26:
cotコマンドでエラーが発生する /cotcommand occasionally fails on macOS 26 coteditor/CotEditor#1933 (in Japanese)