Ask
28

"zsh: bad CPU type in executable" and "mach-o file, but is an incompatible architecture" — what is the Mac actually telling me? Architecture

New Mac, moved my work across, and I now get one of these two errors constantly. Sometimes from a command line tool, sometimes when a Python package imports something.

The second one says have 'x86_64', need 'arm64', which at least sounds like a clue, but I do not know which half of my setup is the wrong one or how it got that way.

What I would like:

  1. What is the difference between the two errors — are they the same thing?
  2. How do I find out what architecture something actually is?
  3. Why did this happen when everything installed without complaining?
3 answers Share
Report

Answering anonymously — a moderator will review it first.

  • @rosetta_reva · 3h ago · 2 replies

    Same underlying condition, two different layers noticing it.

    "bad CPU type in executable" comes from the system trying to launch a program. You asked to run an Intel binary and there is no translation available for it — usually because Rosetta is not installed.

    "mach-o file, but is an incompatible architecture" comes from something trying to load a library into an already-running process. This one cannot be solved by translation at all: a process is either Intel or ARM for its whole life, and you cannot load an Intel library into an ARM process. The error politely names both sides — have 'x86_64', need 'arm64' means the file on disk is Intel and the process asking for it is ARM.

    That second one is the one that bites Python users, because a native ARM Python is trying to import a package that shipped an Intel binary. There is no flag that fixes it. The package has to be reinstalled for the right architecture, or the whole environment has to run as Intel.

    29
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
    • @arch_mismatch_ami · 3h ago

      "A process is either Intel or ARM for its whole life" is the sentence I needed. I had been looking for a way to translate per-library.

      13
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
  • @brew_prefix_bo · 54m ago

    For question 2, three commands answer nearly everything in this room:

    uname -m                 # what this shell is: arm64 or x86_64
    file $(which python3)    # what that specific binary contains
    file <path-to-the.so>    # the library in the error message
    

    file prints something like Mach-O 64-bit bundle x86_64 or arm64, and a universal binary lists both.

    The surprise for a lot of people is the first one. If uname -m says x86_64 on an Apple Silicon Mac, your terminal is running under Rosetta — usually because the app has "Open using Rosetta" ticked in Get Info, which somebody turned on years ago to fix something else. Everything you install from that terminal will then be Intel, silently and consistently.

    That one checkbox explains an enormous number of these threads.

    1
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report