Run macOS Terminal command with Rosetta
On macOS, Terminal commands can be specified to run with Rosetta using the arch
command.
This is useful for running or testing x86_64 software on Apple Silicon Macs.
See “man arch” for more details.
arch -x86_64 <command>
For example to run cmake
with Rosetta:
arch -x86_64 cmake -B build
The CMake variable CMAKE_SYSTEM_PROCESSOR or simply
arch -x86_64 uname -m
can be used to check the architecture of the current process.