How to make an M1-only (native-only) app?

I moved my Intel-based project to my new M1 machine (Pro Max), and it builds and runs fine, but only as a Intel/Rosetta app.

I read that xCode builds a hardware-specific app for testing and debugging, but the app it's building for me is running as an Intel app (regardless of whether I'm running it under xCode or launching it stand-alone).

Under Architectures, it says: Standard Architectures (Apple Silicon, Intel) - $(ARCHS_STANDARD)

What should I put there to force it to make an M1-only app? (I'm making an app just for my own use, not for distribution.)

Post not yet marked as solved Up vote post of musanim Down vote post of musanim
6.2k views

Replies

It looks like $(ARCHS_STANDARD) evaluates to arm64 x86_64, so setting the architecture to just arm64 should build for Apple Silicon only.

I made that change. It still builds, but when I try to run it, I get the message "A build only device cannot be used to run this target."

At the top, is says this ...

... and the "My Mac" (without Rosetta) option is grayed-out. Does that mean that it thinks my machine is Intel-based?

Can you set the architecture in both the project’s and target’s build settings? When I set the architecture to arm64 in both places, I only get the option to build for ‘My Mac’ and ‘Any Mac (Apple Silicon)’ in Xcode 13.1 (13A1030d)

  • When I set both project and target to arm64, the build options are for 'My Mac (unsupported architecture)' and 'Any Mac' (it doesn't say ‘Any Mac (Apple Silicon)’). And when I then try to build it, it says:

    The run destination My Mac is not valid for Running the scheme 'FileRender'. My Mac doesn't support any of MAMFileRender.app's architectures. You can set MAMFileRender.app's Architectures build settings to Standard Architectures to support My Mac.

    (BTW, thanks for your help, Graphics and Games Engineer)

  • @musanim hmm that’s odd… can you upload the project to GitHub? It would be interesting to take a look. This could also be a bug in the Xcode version, do you know which one you are using?

  • I'm running Version 13.1 of xCode. The project is already in GitHub, but it's huge (source tree is nearly 400 GB), and I'd prefer not to make it public (since there are people developing a commercial product based on some of its internals, and they have IP concerns). I guess what I need to do is strip out all the guts and make sure that the empty skeleton does the same thing. I did make a test program from scratch, and it behaved the way I would expect (easy to make an M1-only version). What I'm guessing is that I'm using some library that's not supported natively on the M1; it contains these: QTKit, Cocoa, OpenGL, AVFoundation, ApplicationServices, QuartzCore. I was expecting that there would be problems like the one I'm encountering, but I was also expecting that I'd get a clear error message, like "sorry, Native apps can't use OpenGL; you must switch to Metal." From what I read, I wasn't expecting it to be OpenGL though (since it said it was deprecated but should still work). I don't know enough about the other libraries to guess which one might be the culprit. Or it might be something really trivial (like me somehow telling xCode that my hardware is Intel-based, without realizing it).

I found the answer: there was a User-Defined value for VALID_ARCHS which was set to x86_64. I added arm64 to this, and I'm now running my app as Apple Silicon natively.

i get similar issue but the major issue is i have a project ie. IOS Native app which is develop in intel based chip now i am switching to apple silicon but i get some issue

can any one suggest me or share reference how to run or update to silicon base chip ie macBook m2

Setting the Architecture under Build Settings to arm64 works well:

To get valid architectures, in your project folder, run:

xcodebuild -project <Your project name>.xcodeproj -scheme "Your Project Scheme" -showBuildSettings | grep ARCHS

For my project, it prints:

    ARCHS = arm64 x86_64
    ARCHS_STANDARD = arm64 x86_64
    ARCHS_STANDARD_32_64_BIT = arm64 x86_64 i386
    ARCHS_STANDARD_32_BIT = i386
    ARCHS_STANDARD_64_BIT = arm64 x86_64
    ARCHS_STANDARD_INCLUDING_64_BIT = arm64 x86_64
    VALID_ARCHS = arm64 arm64e i386 x86_64

This is where I got arm64 as the value.

What solved it for me (on Xcode 15, not sure if this works on earlier versions) was to set the shown destinations. I'm not really sure why this option exists.