How can I run a command or script in rosetta from terminal on M1 Mac?
Asked Answered
Q

1

9

How can I run a program or shell script in Rosetta from Terminal? I don't want to run the whole terminal in Rosetta. Just the parts I need.

Quimper answered 10/2, 2022 at 13:5 Comment(0)
Q
12

The arch command is useful for that purpose

arch -arch_name binary args ...

See man arch for more details

Example without rosetta:

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

Output:

arm64

(could run this with /bin/bash ./build.sh directly)

Example with rosetta:

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

Output:

i386
Quimper answered 10/2, 2022 at 13:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.