🦾 How to run xcodebuild using Rosetta on Xcode 14.3+
Apple changed how Xcode is supposed to run Rosetta simulators on Xcode 14.3. Learn how this affects xcodebuild.
Xcode 14.3 removed the Rosetta mode from the application’s “info” panel, and moved it to simulators instead.
If you catch yourself in need to run Xcode 14.3 under Rosetta via the UI, check out this awesome article made by @sarunw: https://sarunw.com/posts/open-using-rosetta-in-xcode-14-3
Now, if you’re looking to run Xcode 14.3 under Rosetta via CLI (using xcodebuild), you need to use the same trick that was used to run macOS apps:
xcodebuild -workspace MyWorkspace.xcworkspace -scheme MyScheme -destination 'platform=iOS Simulator,name=iPhone 14 Pro,arch=x86_64' clean build test
In other words, simply append ,arch=x86_64
to your destination
argument.
And if you’re using fastlane, since 2.113.0 you can pass this argument to fastlane scan CLI:
bundle exec fastlane scan --clean --workspace MyWorkspace.xcworkspace --scheme MyScheme --device "iPhone 14 Pro" --run_rosetta_simulator
Or add the same argument to your scan action in your Fastfile:
desc "Runs all the tests"
lane :test do
scan(
workspace: "MyWorkspace.xcworkspace",
scheme: "MyScheme",
device: "iPhone 14 Pro",
run_rosetta_simulator: true,
)
end
Conclusion
Since Apple enforced Xcode 14.1 to be installed as of late April, when Xcode 14.3 was already available, many of us saw ourselves upgrading to Xcode 14.3 straight away, instead of going through 14.1 or 14.2. For those of you who don’t support running Xcode builds (and simulator runs) on native Apple Silicon, these config changes will be needed when running on Xcode 14.3.