Repository navigation
install_mac_app: launch natively on Apple Silicon instead of under Rosetta - #69
Merged
Merged
Conversation
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.
Problem
When the app installed by
scripts/install_mac_app.shis launched from Finder/Spotlight on Apple Silicon, the terminal's shell runs as x86_64 (uname -m=>x86_64).The bundle's
CFBundleExecutableis a#!/bin/shshim with no Mach-O header, so LaunchServices can't infer its architecture and may start it under Rosetta. A translated parent prefers the x86_64 slice of universal binaries, so the Intel preference leaks down to the shell.Fix
/usr/bin/arch -arm64whenhw.optional.arm64is1(this reports the hardware, so it's still correct when the shim itself is translated). Intel Macs are unchanged.LSArchitecturePriority(arm64,x86_64) to the generated Info.plist.Testing
bash -non the script andsh -non the rendered shim pass.scripts/install_mac_app.sh, launch Toastty from Finder, and rununame -m(expectarm64). If LaunchServices has cached the old decision, log out and back in.uname -mstill saysx86_64, checkfile ~/Library/Application\ Support/Toastty/toastty. An x86_64-only binary means the Rust toolchain is the Intel one (rustc -vV | grep host).Created with Perplexity