Bad CPU type in executable

I made a simple app in Swift.

Compilation was on MacBook Pro 16 (Apple M3 Pro) / Sonoma 14.4.1, and the XCode version used was 15.3.

When I run this app on Big Sur(11.5.2) / Intel Core i5 iMac, following message is noticed. "The 'MYAPP' application cannot be opened because this application is not supported on this Mac." If I run MyApp.app/Contents/MacOS/myapp directly, “...Bad CPU type in executable”is displayed.

Build Settings are as follows:

  • Minimum Deployments: macOS 11.0
  • Architectures: Standard Architectures (Apple Silicon, Intel) - $(ARCHS_STANDARD)
  • Build Active Architecture Only : Debug - Yes / Release - No
  • Code Signing by : Development ID

and notarization is completed

Additionally, SimpleFirewall (The Network Extension example) works well on Big Sur. I compared all settings with The SimpleFirewall project and couldn't find anything unusual.

Answered by SaferZone in 787856022

This was solved by changing "Build/Override Architectures" from "Match Run Destination" to "Use Target Settings" in the settings window displayed after executing the "Product/Scheme/Edit Scheme..." menu.

did you build on your M3 machine and copy the app manually from it to the Intel machine?

You have elected to build both architectures (for development), but if you just hit Build or Debug, you'll get the active architecture only. You need to Archive then select Distribute for Debugging, for example. Or, change the Build Active Architecture Only setting to 'no' and just copy your local build.

Thank you for reply. I already performed the below actions and got "Bad CPU type..." result.


I changed "Build Active Architecture Only" setting to "No" for both Debug and Release.

And I run the "Product/Scheme/Edit Scheme..." menu and changed everything from Debug to Release.

The compiled file was created in the Release folder, and I notarize it on M3 Machine.

After then I manually copied this file to the Intel machine and run it.


Notarize Steps are as Follows and it successfully done.

  • ditto -c -k --keepParent "$APP_NAME" "$APP_ZIP"
  • xcrun notarytool submit ./$APP_ZIP --wait --keychain-profile "$AC_KEYCHAIN"
  • xcrun stapler staple "$APP_NAME"

Accepted Answer

This was solved by changing "Build/Override Architectures" from "Match Run Destination" to "Use Target Settings" in the settings window displayed after executing the "Product/Scheme/Edit Scheme..." menu.

Bad CPU type in executable
 
 
Q