8

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.

1 Answer 1

8

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
10
  • 2
    Ahhh got it. I thought it was an issue during migration or something. I'll submit a bug with Apple through Feedback Assistant. Thanks for the tip! Wasn't sure if it was just me. Nov 5, 2021 at 16:14
  • @CharlieFish Actually I'm surprised mandoc is even called from man. Do you have some custom stuff installed/configured?
    – nohillside
    Nov 5, 2021 at 16:28
  • One thing I really dislike about computers is it's extremely hard to know the answer to that question. Yes, it's very possible that some custom thing or configuration I had ages ago is causing this. I have no idea where I'd even look for that tho. A lot of old Homebrew stuff got migrated over during the transfer. Overtime more things get installed and junk clutters your computer. And there are so many places for things to hide. REALLY hard to clean everything up, and know what is even safe to clean up/delete. Nov 5, 2021 at 16:59
  • 1
    @nohillside I have a clean install on an M1 Mac and am encountering this without having done any customization.
    – leafmeal
    Dec 15, 2021 at 5:38
  • 2
    This has now been fixed in the macOS Monterey 12.1 update - there are no non-ARM binaries in /usr/bin anymore.
    – fornwall
    Dec 15, 2021 at 19:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .