What does errno 85 (EBADEXEC) mean?

 
Could be also:
ConstantTypeOS
ERROR_ALREADY_ASSIGNEDWin32 errorWindows
ERESTARTerrnoLinux
ELIBSCNerrnoSolaris
DATA_COHERENCY_EXCEPTIONBugCheck CodeWindows
Previous Next
EOVERFLOW EBADARCH

EBADEXEC

EBADEXEC is a Darwin program-loading error. It says that an image presented for execution was rejected as a bad executable. This is more specific than merely finding an unexpected file suffix, but it does not by itself identify the failing layer: the kernel, launcher, dynamic loader, or a higher-level API may expose different diagnostics around the same artifact.

Do not merge it with the standard ENOEXEC case. XNU defines ENOEXEC as the generic “Exec format error” and separately defines EBADEXEC as “Bad executable.” The distinction is useful when a log preserves the numeric Darwin errno: collect the originating call and the complete error text instead of treating both as one generic corruption message.

Why a Mach-O-looking file may still be unusable

The Mach-O header identifies the image type. XNU distinguishes relocatable objects, demand-paged executables, dynamic libraries, bundles, and other file types. An object file or a dynamic library is not automatically a launchable main executable, and an executable image also has load commands that describe the loader work required to run it.

Focused checks

  • Inspect the image class with file <path> and otool -hv <path>; preserve the output with the original file.
  • Inspect load commands with otool -l <path>, especially when the problem began after packaging, binary rewriting, or a partial deployment.
  • Check the CPU slices separately with lipo -archs <path>; an architecture mismatch is represented by EBADARCH, not by this code.
  • For an error from dlopen, capture dlerror() immediately. Apple documents that this API supplies the descriptive string for the most recent dynamic-loader error.

Restoring the executable from the same build output is safer than editing Mach-O headers or load commands in place. Any repair should be validated again as a complete application artifact, including its dependent libraries and signature policy.

References


Looking for a different code? Search another status or error code.