hfossli
hfossli

Reputation: 22962

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

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.

Upvotes: 10

Views: 10560

Answers (1)

hfossli
hfossli

Reputation: 22962

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

Upvotes: 13

Related Questions