Declare native execution in macOS .app bundle Info.plist#27591
Open
KiloNiner wants to merge 2 commits into
Open
Declare native execution in macOS .app bundle Info.plist#27591KiloNiner wants to merge 2 commits into
KiloNiner wants to merge 2 commits into
Conversation
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
Contributor
There was a problem hiding this comment.
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
LSRequiresNativeExecutionset totruein the packaged app’s Info.plist template.
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).
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Adds
LSRequiresNativeExecution = trueto the macOS launcher appInfo.plisttemplate so opening/Applications/PowerShell.appon Apple Silicon does not trigger a Rosetta prompt.PR Context
On Apple Silicon, double-clicking
/Applications/PowerShell.appfrom theosx-arm64.pkgproduces a "To open PowerShell, you need to install Rosetta" prompt, even though the underlyingpwshbinary is arm64-native and runningpwshfrom 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.dylibwere 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:CFBundleExecutableis a shell script (PowerShell.sh), not a Mach-O binary, so Launch Services cannot infer architecture from the executable.Info.plisthas noLSRequiresNativeExecutionkey.With nothing telling Launch Services the bundle is native, Apple Silicon defaults to offering Rosetta. Ironically the actual
pwshthat ends up running is arm64 either way — Rosetta would only be wrapping the launcher script.Setting
LSRequiresNativeExecution = truetells 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 bothosx-arm64.pkgandosx-x64.pkgbuilds without conditional logic.Verified on a fresh install of
powershell-7.6.2-osx-arm64.pkg:The existing macOS package validation tests in
test/packaging/macos/package-validation.tests.ps1verify 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
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header