Determine if macOS Program is Emulated x86 or Native ARM

apple-siliconcommand linem1

I have an M1 MacBook Pro and have downloaded both some native (ARM) and x86_64(Rosetta 2 emulated) binaries.

  1. How do I determine from the command line which of these ISAs a particular binary file is?
  2. Is there any way to know if a currently running program is running
    native or under Rosetta 2?

Best Answer

Run file on a binary:

krismatth@KristophersMBP3 ~$ file /bin/bash
/bin/bash: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/bin/bash (for architecture x86_64):    Mach-O 64-bit executable x86_64
/bin/bash (for architecture arm64e):    Mach-O 64-bit executable arm64e

Activity Monitor shows the architecture of running programs:

enter image description here