mach-o file, but is an incompatible architecture macOS Origin: Platform & cloud OSI layer 7 · Application Last updated 5 Nov 2026

macOS: dlopen: mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')

A library or binary was built for a different CPU architecture than the process loading it.

Exact message you may see mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')dlopen mach-o file but is an incompatible architecturemach-o, but wrong architectureincompatible architecture (have 'arm64', need 'x86_64')ImportError: dlopen mach-o file incompatible architecture
Seen on: macOS Node.js

Meaning

The process is arm64 but the library is x86_64 (or the other way). Reinstall the dependency for arm64 (Homebrew in /opt/homebrew), rebuild native modules (npm rebuild, pip install --force-reinstall), or run the whole stack under Rosetta consistently (arch -x86_64). Mixing Intel and ARM Homebrew prefixes causes this often.

Common causes

  • Native module compiled for x86_64 under an arm64 Node/Python
  • Libraries from /usr/local (Intel) used by arm64 apps
  • Universal binary missing a slice
  • Docker platform mismatch
  • Old prebuilt wheels

⚡ Quick fix

  1. Rebuild native modules: npm rebuild / pip install --no-binary :all: PKG
  2. Reinstall Homebrew packages under /opt/homebrew
  3. Run everything in Rosetta: arch -x86_64 zsh

Detailed fix by platform

macOS

  1. lipo -info /path/lib.dylib and file $(which node)

How to diagnose

  1. Arch — Process vs library?
  2. Prefix — /opt/homebrew vs /usr/local?
  3. Rebuild — Native modules?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

dyld: Library not loaded — macOS: dyld[123]: Library not loaded: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib — Reason: tried: ... (no such file) (macOS)dyld: Library not loa…dyld: Symbol not found — macOS: dyld: Symbol not found: _SecTrustCopyCertificateChain — Expected in: /System/Library/Frameworks/Security.framework (macOS)dyld: Symbol not foundHomebrew Cask: It seems there is already an App at — Homebrew: Error: It seems there is already an App at '/Applications/Chrome.app' (macOS)Homebrew Cask: It see…Homebrew: No available formula with the name — Homebrew: Error: No available formula with the name "x". Did you mean ...? (macOS)Homebrew: No availabl…No Xcode or CLT — gyp: No Xcode or CLT version detected! (npm)No Xcode or CLTNokogiri: could not find a platform gem / libxml2 build error — Bundler: Your bundle only supports platforms ["x86_64-linux"] but your local platform is arm64-darwin / Could not find gem 'nokogiri (1.16.0-arm64-darwin)' (Ruby / Rails)Nokogiri: could not f…Rosetta 2 not installed — macOS: Rosetta is not installed — softwareupdate --install-rosetta failed / Install Rosetta to open Intel apps (macOS)Rosetta 2 not install…Your Command Line Tools are too outdated — Homebrew: Error: Your Command Line Tools (CLT) are too outdated. Update them from Software Update / Please update to the latest macOS (macOS)Your Command Line Too…mach-o fi…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.