From 1aa33e68dc988bc641524bb1eb8d16522b145c14 Mon Sep 17 00:00:00 2001 From: Karsten Sandmand Date: Wed, 10 Jun 2026 20:11:36 +0200 Subject: [PATCH 1/2] Declare native execution in macOS .app bundle Info.plist Add LSRequiresNativeExecution to the macOS launcher app Info.plist so Apple Silicon Launch Services does not offer Rosetta when opening /Applications/PowerShell.app. The shipped pwsh binary is arm64-native in the osx-arm64 package; the Rosetta prompt is purely a bundle-metadata artifact (script-based CFBundleExecutable, unsigned bundle, no arch hint in the plist). The key is a no-op on Intel Macs (no Rosetta translates Intel binaries on Intel hardware), so it is safe to add unconditionally to the shared template used for both osx-arm64.pkg and osx-x64.pkg builds. Fixes #18548 --- tools/packaging/packaging.strings.psd1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/packaging/packaging.strings.psd1 b/tools/packaging/packaging.strings.psd1 index 0bf14ff0dbe..d5af9b5e8a4 100644 --- a/tools/packaging/packaging.strings.psd1 +++ b/tools/packaging/packaging.strings.psd1 @@ -116,6 +116,8 @@ open {0} CFBundleVersion {1} + LSRequiresNativeExecution + '@ From 9b492c6a07673423383e13a7b2dd0adb5f4029e5 Mon Sep 17 00:00:00 2001 From: Karsten Sandmand Date: Wed, 10 Jun 2026 20:28:23 +0200 Subject: [PATCH 2/2] Scope LSRequiresNativeExecution to arm64 builds only Address review feedback: only emit the LSRequiresNativeExecution key in the launcher Info.plist for osx-arm64 builds, not for osx-x64. The previous version added the key unconditionally to the shared template. That is safe on Intel Macs (the key is a no-op on hardware where Rosetta does not translate Intel binaries) and on Apple Silicon running the arm64 build (the goal), but it would prevent the .app launcher from working under Rosetta if an Apple Silicon user installs the osx-x64 package -- an unsupported but previously-working configuration. Make the substitution conditional via a new HostArchitecture parameter on New-MacOSLauncher, threaded through from New-UnixPackage where HostArchitecture is already in scope ("arm64" or "x86_64" for osxpkg builds). The plist template gains a {3} placeholder that receives either the LSRequiresNativeExecution block (arm64) or empty (x86_64). --- tools/packaging/packaging.psm1 | 21 ++++++++++++++++++--- tools/packaging/packaging.strings.psd1 | 4 +--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index bb6c82aca7f..753835e27e9 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -1242,7 +1242,7 @@ function New-UnixPackage { if ($PSCmdlet.ShouldProcess("Add macOS launch application")) { # Generate launcher app folder - $AppsFolder = New-MacOSLauncher -Version $Version + $AppsFolder = New-MacOSLauncher -Version $Version -HostArchitecture $HostArchitecture } } @@ -2369,7 +2369,13 @@ function New-MacOSLauncher [Parameter(Mandatory)] [String]$Version, - [switch]$LTS + [switch]$LTS, + + # When "arm64", emits LSRequiresNativeExecution in the app's Info.plist so + # Apple Silicon Launch Services does not offer Rosetta when launching + # /Applications/PowerShell.app. Leave empty / non-arm64 to preserve the + # ability to launch x86_64 builds under Rosetta on Apple Silicon. + [string]$HostArchitecture ) $packageInfo = Get-MacOSPackageIdentifierInfo -Version $Version -LTS:$LTS @@ -2398,9 +2404,18 @@ function New-MacOSLauncher # Copy icns file. Copy-Item -Force -Path $iconfile -Destination "$macosapp/Contents/Resources" + # On arm64 builds, declare native execution so Launch Services does not + # offer Rosetta for the bundle. Omitted on x86_64 so that build remains + # launchable under Rosetta if installed on Apple Silicon. + $nativeExecutionKey = if ($HostArchitecture -eq "arm64") { + " LSRequiresNativeExecution`n `n" + } else { + "" + } + # Create plist file. $plist = "$macosapp/Contents/Info.plist" - $plistcontent = $packagingStrings.MacOSLauncherPlistTemplate -f $packageId, $Version, $iconfilebase + $plistcontent = $packagingStrings.MacOSLauncherPlistTemplate -f $packageId, $Version, $iconfilebase, $nativeExecutionKey $plistcontent | Out-File -Force -Path $plist -Encoding utf8 # Create shell script. diff --git a/tools/packaging/packaging.strings.psd1 b/tools/packaging/packaging.strings.psd1 index d5af9b5e8a4..7e44a163c7d 100644 --- a/tools/packaging/packaging.strings.psd1 +++ b/tools/packaging/packaging.strings.psd1 @@ -116,9 +116,7 @@ open {0} CFBundleVersion {1} - LSRequiresNativeExecution - - +{3} '@