Change Default XCode Architecture

Viewed 946

In Xcode 12, the default architecture for building got changed to arm64. This causes many things to not build.

In this instance, running pip install psutil fails to build with an "architecture not supported error".

How can I change the default build architecture for xcode 12?

2 Answers

Try removing arm64 from the "Valid architecture" under the build setting of your Xcode project

Supported screenshot

There are two ways:

xcodebuild -arch

If you have a folder with .xcodeproj file in it, you can run xcodebuild -arch architecture <other options> to use a particular arch.

Xcode build settings.

Use VALID_ARCHS and/or ARCHS environment variables to let Xcode use those settings.

It can be set via CMAKE_XCODE_ATTRIBUTE_* also.

There are several undocumented variables also, which you can find by running xcodebuild -showBuildSettings or adding a post build script with a no-op command, and show env vars in build log ticked.

If either of them has the bad arch set, just overwrite it.

Related