4

I exported the following line of AppleScript code into an macOS application via the "Script Editor":

do shell script "open '/Applications/Google Chrome.app'  --args --proxy-server=socks5://127.0.0.1:1080"

Then, inside the application bundle, I replaced the file Contents/MacOS/applet with a bash script file.

(I'm not familar with AppleScript, and want to modify the script directly without using the "Script Editor".)

The shell-script-based application has been working fine for years under Intel-based Macs.

However, when launching it under my new M2 Max MacBook Pro, macOS shows a window saying:

To open "xxxx", you need to install Rosetta. Do you want to install it now? Rosetta enables Intel-based features to run on Apple silicon Macs. Reopening applications after installation is required to start using Rosetta.

Why does macOS treat plain-text script as "Intel-based features" and insist on running it using Rosetta?

How can I run the bash script Application bundle on ARM-based Macs without Rosetta?

Thank you.

1
  • "applet" must be a Mach-O executable, not a plain-text bash script Commented Mar 14, 2023 at 19:30

3 Answers 3

2

This is a repost of my answer on Custom macOS application bundle requires Rosetta even through it shouldn't

This issue seems to occur if you have no ARM format binaries in the MacOS folder. I have found 2 solutions to this bug. One is to just include a ARM binary in the .app/Content/MacOS, even if it does nothing and is used by nothing. You can generate one by running echo 'int main() {return 0;}' | clang -x c -o empty-bin -, and verify it is arm64 by doing lipo -info empty-bin. The other, saner option is to add the following to your plist:

<key>LSArchitecturePriority</key>
<array>
    <string>arm64</string>
</array>

The issue is, MacOS seems to be caching the rosetta flag somewhere outside of the usual places. If I find a way to clear the flag, I'll update this post, but currently the only fix I have is to change your CFBundleIdentifier in the plist. If you get that rosetta window even once, that bundleId will always bring up that window.

4
  • 1
    Re: "rosetta flag": Using the Feedback Assistant, I filed FB14684491 with Apple, caching this flag forever seems to be a bug. Sadly, there's a high likelihood that they won't fix it for ecosystem/congruency reasons as explained here: developer.apple.com/forums/thread/…. (TIL: Not unlike the sad fact that getting a direct link to this developer forums answer only works in Safari). Commented Aug 6, 2024 at 15:57
  • Apple replied FB14684491: "[...] this issue behaves as intended based on the information provided. Apps with scripts as their main binary default to Rosetta for compatibility. When bringing up Rosetta, there were existing apps with scripts as main binary, which kicked off separate processes to inspect their architecture or other characteristics. If those processes are kicked off as arm64, they returned values that were unexpected by the app and weird things happened. Defaulting to Rosetta meant those sub-processes launched as x86_64 and returned values the apps were expecting." Commented Aug 10, 2024 at 16:13
  • I've filed a new feedback ticket with Apple. FB14812783. Although they can claim that defaulting to "Intel" is the "intended behavior", there's no excuse to cache this value indefinitely. Description: "If the main application binary is a shell script, it can be launched on macOS without Rosetta by setting the Info.plist LSArchitecturePriority to arm64. However, if this LSArchitecturePriority was not set previously it’s cached as Intel indefinitely." Commented Aug 15, 2024 at 16:05
  • To clear the cache flag: /usr/libexec/PlistBuddy -c "Delete :\"Architectures for arm64\":com.company.app" ~/Library/Preferences/com.apple.LaunchServices/com.apple.LaunchServices.plist && sudo reboot where com.company.app is the bundle identifier of your application. WARNING: This will reboot your mac if successful. Commented Jun 13, 2025 at 15:38
1

The shell-script-based application has been working fine for years under Intel-based Macs.

There is a 'compiled AppleScript' in the Resources sub-folder, and it may be that which is triggering the call for Rosetta.

You need to re-save the AppleScript app from Script Editor on your ARM Mac, to get an Apple Silicon executable.

Incidentally, you may prefer to use Automator, where you can create a Run Shell Script action and save it as an application.

4
  • Re-exported the script to an Application bundle under Apple silicon Mac. After the main executable is replaced with a script file, the "Rosetta" prompt appears. Commented Mar 14, 2023 at 19:08
  • @SimonL In which case, try the Automator method I mentioned. TBH, I wouldn't baulk at having Rosetta installed, anyway. Commented Mar 14, 2023 at 19:46
  • I'm not sure whether the use of Rosetta will result in the x64 version of the Chrome binary being executed in the emulator. I want Chrome (arm64) to run natively. Commented Mar 15, 2023 at 6:29
  • @SimonL MacOS will run the ARM fork of any app, even if Rosetta is installed, unless you specifically set the checkbox in Get Info to run Intel. I have Rosetta installed and loads of Universal Binary applications, and they all run ARM. I don't have Chrome, because I value RAM and privacy, obviously. ;-) Commented Mar 15, 2023 at 7:40
0

How can I run the bash script Application bundle on ARM-based Macs without Rosetta?

Install the Apple silicon (ARM) version (Chrome).

The error message telling you that you need Rosetta indicates you’re using the version compiled for Intel CPUs and that Rosetta is required. To not require Rosetta, you must install the version of software that was compiled for Apple silicon or ARM CPUs.

5
  • 1
    The executable file is a plain-text bash script. It is NOT Intel binary. Commented Mar 14, 2023 at 19:21
  • The executable would be Chrome Commented Mar 14, 2023 at 19:27
  • 1
    @Allan This issue occurs even if the only files in the bundle are the plist and shell script. Somehow MacOS is throwing the x86 flag on scripts. Commented Aug 3, 2024 at 17:11
  • Agreed. Although this answer is "common sense", it's not correct. Something about Rosetta 2's detection is broken for scripted launchers. developer.apple.com/forums/thread/761342 Commented Aug 6, 2024 at 14:59
  • Slight update, @kyle-berezin 's proposed LSArchitecturePriority seems to fix this, but only for new installs. Once Rosetta 2 has inferred Intel for a scripted Application launcher, it never seems to forget this. Reported to Apple as FB14684491. Hopefully they'll consider fixing this although the sentiments from the developer forum suggest otherwise. Commented Aug 6, 2024 at 16:01

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.