Tell if running process is running under Rosetta or is M1-native by Command Line
Solution 1:
TL,DR: fuser /usr/libexec/rosetta/runtime
I know how to see which processes are non-native. I don't know how to tell between different non-native architectures, but in practice there's only one
A non-native process has the Rosetta runtime open. You can use fuser
to list which processes have a given file open. You can use lsof
to see what files a given process has open.
$ arch -x86_64 sleep 868686 &
[1] 65444
$ sleep 123123123 &
[2] 65446
$ fuser /usr/libexec/rosetta/runtime
/usr/libexec/rosetta/runtime: 65444
$ lsof -p65444 -p65446 | grep /usr/libexec/rosetta/runtime
sleep 65444 gilles txt REG 1,18 220064 1152921500312773394 /usr/libexec/rosetta/runtime
You'll need sudo
to see other users' processes (but normally system processes should be native).
Solution 2:
Here is some snippet to check all Rosetta 2 pids and inspect them:
ps -p `fuser /usr/libexec/rosetta/runtime | sed -e 's/.*: //' | sed -e 's/ /,/g'`