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.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I want to check whether a sandboxed application already has access permission to a specific URL.
Based on my investigation, the following FileManager method seems to be able to determine it:
FileManager.default.isReadableFile(atPath: fileURL.path)
However, the method name and description don't explicitly mention this use case, so I'm not confident there aren't any oversights.
Also, since this method takes a String path rather than a URL, I'd like to know if there's a more modern API available.
I want to use this information to decide whether to prompt the user about the Sandbox restriction in my AppKit-based app.
SwiftUI’s Menu is used also to display view controls like pop-up buttons. However, in such cases, its content is evaluated at the moment the button itself appears, although it’s not required until the menu is actually opened. Additionally, since the menu content isn’t re-evaluated when opened, if the content is dynamically generated, there could be a discrepancy between the actual state and the displayed state depending on the timing.
Considering these points, I’d like to delay generating the menu content until the moment it’s actually opened.
Is there a way to delay the evaluation and generation of the Menu’s content until the moment its contents are displayed?
Note: I'd like to know about using it within a macOS app.
I recently turned on the enhanced security options for my macOS app in Xcode 26.0.1 by adding the Enhanced Security capability in the Signing and Capabilities tab. Then, Xcode adds the following key-value sets (with some other key-values) to my app's entitlements file.
<key>com.apple.security.hardened-process.enhanced-security-version</key>
<integer>1</integer>
<key>com.apple.security.hardened-process.platform-restrictions</key>
<integer>2</integer>
These values appear following the documentation about the enhanced security feature (Enabling enhanced security for your app) and the app works without any issues.
However, when I submitted a new version to the Mac App Store, my submission was rejected, and I received the following message from the App Review team via the App Store Connect.
Guideline 2.4.5(i) - Performance
Your app incorrectly implements sandboxing, or it contains one or more entitlements with invalid values. Please review the included entitlements and sandboxing documentation and resolve this issue before resubmitting a new binary.
Entitlement "com.apple.security.hardened-process.enhanced-security-version" value must be boolean and true.
Entitlement "com.apple.security.hardened-process.platform-restrictions" value must be boolean and true.
When I changed those values directly in the entitlements file based on this message, the app appears to still work. However, these settings are against the description in the documentation I mentioned above and against the settings Xcode inserted after changing the GUI setting view.
So, my question is, which settings are actually correct to enable the Enhanced Security and the Additional Runtime Platform Restrictions?
NSHostingSceneRepresentation, introduced in macOS 26, allows calling SwiftUI’s windows and other elements set in a Scene from AppKit. However, while Settings and WindowGroup set in the Scene can be invoked as expected using environment.openSettings() and environment.openWindow(id:) respectively, calling Window or WindowUtility doesn’t work. That is, the app just fails to open the desired window with the provided ID, and no error message or other feedback/crash/freeze appears.
I expect that executing the openUtilityWindow(_:)action in the following code will display the UtilityWindow set in the scene. However, the window does not actually open.
@main
final class AppDelegate: NSObject, NSApplicationDelegate {
private let scene = NSHostingSceneRepresentation {
UtilityWindow("Utility Window", id: "UtilityWindow") {
Text("Utility Window")
.scenePadding()
}
}
func applicationWillFinishLaunching(_ notification: Notification) {
NSApp.addSceneRepresentation(self.scene)
}
@IBAction func openUtilityWindow(_ sender: Any?) {
self.scene.environment.openWindow(id: "UtilityWindow")
}
}
Is there something wrong with my implementation and expectation? Or is this a bug in NSHostingSceneRepresentation?
Just in case, I’ve already filed this issue withFeedback Assistant: FB20310722
This feedback also includes a sample project reproducing this issue.
On macOS Tahoe 26, NSSplitViewController introduced the NSSplitViewItemAccessoryViewController and related-APIs in NSSplitViewController, such as addBottomAlignedAccessoryViewController(_:).
Those APIs allow you to place accessory views at the top and bottom of a split view with a nice edge effect.
I understand how to use them with AppKit. However, I’m not sure how to achieve the same functionality with SwiftUI.
In SwiftUI on macOS, A menu-style Picker is drawn as a pop-up button.
It generally looks and behaves the same as an NSPopUpButton in AppKit.
SwiftUI introduced iOS-like looking UI for settings in macOS, and consequently, the Picker also has its own style when placed inside a Form.
A Form-style Picker displays only up/down chevrons and draws the background only when the mouse hovers over it. It also changes its width dynamically based on the selected item.
Form {
Picker("Animal:", selection: $selection) {
ForEach(["Dog", "Cow"], id: \.self) {
Text($0)
}
.pickerStyle(.menu)
}
You can find it, for instance, in the Print dialog.
My question is: I couldn't find a way to draw an NSPopUpButton in AppKit with this style. Does anyone know how to achieve this in AppKit?
Some might say I should just use SwiftUI straightforwardly, but I would like to use it in a print panel accessory that currently still avoids using SwiftUI but its dialog has SwiftUI.Form-looking.