Apple Silicon: /usr/bin/mandoc: Bad CPU type in executable
I recently upgraded from an Intel Mac to an Apple Silicon Mac. When running man ssh
then hitting Q
in Terminal it throws the following error:
sh: /usr/bin/mandoc: Bad CPU type in executable
My guess is for some reason it transferred over that executable from my Intel Mac?
But when I try to rename that file or move it (even with sudo
), it says operation not permitted.
How can I fix this without installing Rosetta 2? The odds that someday Rosetta 2 will be removed are high (just like Rosetta 1). So I really want to fix the root problem as opposed to just installing Rosetta.
macOS 12.1 delivers updated versions of the commands listed below so Rosetta 2 is no longer required to run /usr/bin/mandoc
.
That's interesting.
$ file /usr/bin/mandoc
/usr/bin/mandoc: Mach-O 64-bit executable x86_64
So Apple indeed ships macOS (Monterey in my case) with some binaries only compiled for x86.
You'll have to install Rosetta to make this work (it's probably safe to assume that Apple will provide ARM versions for all binaries before getting rid of Rosetta 2).
PS: There seem to be only three binaries not compiled for ARM
$ for i in {/usr,}/{s,}bin/*; do lipo $i -info 2>/dev/null; done | grep -v arm64e
Non-fat file: /usr/bin/demandoc is architecture: x86_64
Non-fat file: /usr/bin/mandoc is architecture: x86_64
Non-fat file: /usr/bin/mandoc_soelim is architecture: x86_64