11

Is it possible to start a program using the command line in a way that has it run by Rosetta 2, without having the application setting that forces the program to always be running under Rosetta 2.

e.g.

  • click dock icon for Xcode → launches Xcode NOT through Rosetta 2
  • run open -a xcode --rosetta2 → launches Xcode through Rosetta 2

1 Answer 1

19

You can use the arch command to force a preferred slice loading order for universal binaries. In your particular case, you would first make sure to Get Info on Xcode and uncheck the "Open using Rosetta" checkbox in Finder. Then via command line you can force loading the x86_64 slice:

arch -x86_64 /Applications/Xcode.app/Contents/MacOS/Xcode

See man arch for more details.

Example:

echo "arch" > build.sh
arch -arm64 /bin/bash ./build.sh 
arch -x86_64 /bin/bash ./build.sh

Outputs:

arm64
i386
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .