Skip to content

Declare native execution in macOS .app bundle Info.plist#27591

Open
KiloNiner wants to merge 2 commits into
PowerShell:masterfrom
KiloNiner:fix/macos-app-rosetta-prompt
Open

Declare native execution in macOS .app bundle Info.plist#27591
KiloNiner wants to merge 2 commits into
PowerShell:masterfrom
KiloNiner:fix/macos-app-rosetta-prompt

Conversation

@KiloNiner

Copy link
Copy Markdown

PR Summary

Adds LSRequiresNativeExecution = true to the macOS launcher app Info.plist template so opening /Applications/PowerShell.app on Apple Silicon does not trigger a Rosetta prompt.

PR Context

On Apple Silicon, double-clicking /Applications/PowerShell.app from the osx-arm64.pkg produces a "To open PowerShell, you need to install Rosetta" prompt, even though the underlying pwsh binary is arm64-native and running pwsh from a terminal works without any prompt. This has been reported repeatedly (#18548, #27587, and historical #17130 whose original dylib root cause no longer applies — libmi.dylib / libpsrpclient.dylib were removed and all remaining dylibs in the arm64 package are arm64 or universal).

The surviving root cause is in the static bundle metadata generated from tools/packaging/packaging.strings.psd1:

  • CFBundleExecutable is a shell script (PowerShell.sh), not a Mach-O binary, so Launch Services cannot infer architecture from the executable.
  • The bundle is unsigned.
  • The Info.plist has no LSRequiresNativeExecution key.

With nothing telling Launch Services the bundle is native, Apple Silicon defaults to offering Rosetta. Ironically the actual pwsh that ends up running is arm64 either way — Rosetta would only be wrapping the launcher script.

Setting LSRequiresNativeExecution = true tells Launch Services explicitly that the bundle must run natively, which suppresses the Rosetta prompt on Apple Silicon. The key is a no-op on Intel Macs (no Rosetta translates Intel binaries on Intel hardware), so it is safe to add to the shared template used for both osx-arm64.pkg and osx-x64.pkg builds without conditional logic.

Verified on a fresh install of powershell-7.6.2-osx-arm64.pkg:

$ file /usr/local/microsoft/powershell/7/pwsh
/usr/local/microsoft/powershell/7/pwsh: Mach-O 64-bit executable arm64

$ /usr/libexec/PlistBuddy -c "Print" /Applications/PowerShell.app/Contents/Info.plist
# (no LSRequiresNativeExecution key)

$ codesign -dvv /Applications/PowerShell.app
/Applications/PowerShell.app: code object is not signed at all

The existing macOS package validation tests in test/packaging/macos/package-validation.tests.ps1 verify that the plist exists and the bundle structure is correct, but do not assert on plist contents, so no test changes are required.

Fixes #18548

PR Checklist

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 PowerShell#18548
Copilot AI review requested due to automatic review settings June 10, 2026 18:14
@KiloNiner KiloNiner requested review from a team and jshigetomi as code owners June 10, 2026 18:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds an Info.plist setting during packaging to require native execution on macOS.

Changes:

  • Adds LSRequiresNativeExecution set to true in the packaged app’s Info.plist template.

Comment thread tools/packaging/packaging.strings.psd1 Outdated
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).
@KiloNiner

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS powershell-7.3.0-osx-arm64.pkg installs without rosetta but /Applications/PowerShell still requires rosetta

2 participants