Checking If A Binary Is Universal

With the M1 Macs out and getting my hands on an M1 Mac mini, I got curious which applications are installing as Universal Binaries for ARM, and which are x86 only and need Rosetta 2 to run.

Thanks to Eric who pointed me to the file (/usr/bin/file) command. From the manual page: “file — determine file type”. Neat.

Here’s the expected output from checking a CLI binary:

ARM: file /usr/bin/python

/usr/bin/python: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]

x86: file /usr/local/bin/python3

/usr/local/bin/python3: Mach-O 64-bit executable x86_64

And here’s how to check application bundle binary:

ARM: file "/Applications/World of Warcraft/_retail_/World of Warcraft.app/Contents/MacOS/World of Warcraft"

/Applications/World of Warcraft/_retail_/World of Warcraft.app/Contents/MacOS/World of Warcraft: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64]
/Applications/World of Warcraft/_retail_/World of Warcraft.app/Contents/MacOS/World of Warcraft (for architecture x86_64):    Mach-O 64-bit executable x86_64

x86: file /Applications/Battle.net.app/Contents/MacOS/Battle.net

/Applications/Battle.net.app/Contents/MacOS/Battle.net: Mach-O 64-bit executable x86_64

The one thing that I know this doesn’t handle is any extra resource or framework binaries that an app bundle might have. This should give you a quick idea of what is or isn’t Universal, though.

Happy exploring.