Saturday, November 16, 2024

macos – Reset Rosetta Flag for Desktop App

A little bit of background: If you make an app with no compiled Arm64 binaries in the Content/MacOS folder, MacOS erroneously identifies it as an Intel based app. After launching the app, MacOS will prompt the user to install rosetta, despite the app running fine natively. I found a simple solution to this issue, either include a do-nothing compiled binary to Contents/MacOS, or add

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

to the plist. I posted the solution here Shell script application bundle prompts for Rosetta installation

The problem is this change only fixes the issue if you also change the BundleID. If you run the app even once with the bad configuration, MacOS seems to cache the intel flag somewhere based on the BundleID. It does not seem to be cached in the usual places.

How to reproduce: (On apple silicon)

  1. You probably already have rosetta, and it is a pain to remove, so a VM is likely needed.
  2. Make an empty app with Script Editor, export with file format: Application.
  3. Replace Example.app/Content/MacOS/applet with a script of the same name. Make sure the old applet is gone, don’t rename it and leave it in the directory. I used:
#!/usr/bin/osascript
display dialog "Hello, world"
  1. Make it executable sudo chmod +x ./Example.app/Content/MacOS/applet
  2. Run it and observe that it asks you to install rosetta
  3. Add the previously mentioned fix to you plist, including the BundleID change
  4. Run it and observe that it now works
  5. Change your BundleID back. Running this now raises the rosetta prompt despite the fact that it runs fine on a clean install of MacOS.

Things I have tried:

  • Rebooting, no effect
  • Reforming the app, no effect
  • Reboot in recovery mode, no effect
  • ~/Library/Preferences, ~/Library/Caches, /Library/Preferences, and /Library/Caches, none contain an entry for the BundleId
  • defaults delete, domain not found

I am not great with MacOS so it is possible I am overlooking something simple.

Related Articles

Latest Articles