ADVERTISEMENT
Buzam.net
  • Home
  • Tech News
  • Smartphones
  • Apple
  • Shop
No Result
View All Result
  • Home
  • Tech News
  • Smartphones
  • Apple
  • Shop
Cart / $0.00

No products in the basket.

  • Home
  • Tech News
  • Smartphones
  • Apple
  • Shop
No Result
View All Result
Buzam.net
No Result
View All Result
Home Apple

Why is a macOS app whose executable is a shell script launching as x86_64 on an arm64 mac?

by buzam team
10 November 2023
in Apple
0
Disk Utility - please help.  Someone actually came and downloaded a script that removed the added partitions of the internal disk, and it can't just update MAC OS X
0
SHARES
3
VIEWS
Share on FacebookShare on Twitter

I have a macOS application whose executable is a shell script. That is, the file in its Contents/MacOS subdirectory whose name is specified in its CFBundleExecutable property is an executable shell script rather than a binary.

I want the script’s process to match the system’s architecture by default, and its running architecture matters because the script has some logic in it that does different things depending on the architecture.

Per Apple’s documentation, its Info.plist file contains an LSArchitecturePriority key that prioritizes arm64 over x86_64 so that it will run natively on Apple Silicon macs.

However if I launch the app from the Finder, for some reason it’s always running as x86_64 instead of arm64.

I confirmed this by making the shell script contain the following:

#!/bin/sh
uname -m >> ~/Desktop/log.txt
sleep 5

…and seeing that the text that gets appended to log.txt is always x86_64 if I launch the app from the Finder. I can also see its architecture is Intel in Activity Monitor.

I know there are other ways of detecting whether the script is running on an arm64 mac, regardless of whether the process itself is arm64 or x86_64, but I want the user to be able to run the app using either architecture (for example by using arch -x86_64 or arch -arm64 when running it from the command line). But it should always default to the system’s native architecture when launched from the Finder. This isn’t a problem if an app bundle’s executable is a universal binary, so it seems to be related to it being a shell script.

Why is it launching as x86_64 instead of arm64? Is there a way to fix it?

I did find one relevant bit of Apple’s documentation in Building a Universal macOS Binary:

If an app doesn’t contain an executable binary, the system may run it under Rosetta translation as a precautionary measure to prevent potential runtime issues. For example, the system runs script-only apps under Rosetta translation. If you verified that your app runs correctly on both Apple silicon and Intel-based Mac computers, add the LSArchitecturePriority key to your app’s Info.plist file and list the arm64 architecture first.

Given that using LSArchitecturePriority isn’t working, this is looking increasingly like a macOS bug, but I’m curious if there’s any workaround or other explanation as to what’s going on.

ShareTweetPin

Related Posts

Disk Utility - please help.  Someone actually came and downloaded a script that removed the added partitions of the internal disk, and it can't just update MAC OS X
Apple

macos – Mail.app’s unwanted return to the index screen

11 December 2023
Australia Park
Apple

‘Life-threatening’ Apple Maps error is fixed

11 December 2023
Beeper Mini
Apple

Apple admits to blocking Beeper Mini’s iMessage trick, surprising no one

11 December 2023
Senator Warren cries antitrust in Beeper Mini affair
Apple

Senator Warren cries antitrust in Beeper Mini affair

11 December 2023
Apple begins scheduling Vision Pro training for retail employees as launch nears
Apple

Apple begins scheduling Vision Pro training for retail employees as launch nears

11 December 2023
Kuo: New Larger 12.9-inch iPad Air Coming in Early 2024
Apple

12.9-Inch iPad Air Display Shipments Reportedly Underway Ahead of March 2024 Launch

11 December 2023
Next Post
OnePlus 12 renders

The OnePlus 12 camera should be just as good as the OnePlus Open

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • A look at the race among chip giants to make 2nm chips, as Samsung and Intel see the next leap in chip manufacturing a chance to close the gap with TSMC (Financial Times)
  • POCO To Unveil Three New Smartphones: X6, X6 Pro, and M6 5G
  • macos – Mail.app’s unwanted return to the index screen
  • Quordle today – hints and answers for Monday, December 11 (game #686)
  • ZimaCube NAS hands-on: This 6-bay NAS has a lot of potential

Recent Comments

  1. ufac4 on Prime Video: The 37 Absolute Best TV Shows to Watch
  2. ufa on The AirPods Pro drop back to an all-time low, plus the rest of this week’s best tech deals
  3. 1ufabet on Prime Video: The 37 Absolute Best TV Shows to Watch
  4. ufanance on Prime Video: The 37 Absolute Best TV Shows to Watch
  5. ดูบาสสด on The AirPods Pro drop back to an all-time low, plus the rest of this week’s best tech deals
  • Home
  • About
  • Contact us
  • Privacy Policy
  • Refund and Returns Policy

DISCLAIMER

The information provided on Buzam.net is for general informational purposes only and should not be construed as professional advice.

© 2023 buzam.net . All right go to their respective owners

No Result
View All Result
  • Home
  • Tech News
  • Smartphones
  • Apple
  • Shop

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.