Home

MachO

Mach-O, short for Mach Object, is a binary file format used for executables, object code, shared libraries, and core dumps on Apple operating systems including macOS, iOS, watchOS, and tvOS. It originated from the Mach kernel and NeXTSTEP, and was adopted by Apple with Mac OS X to replace earlier formats such as a.out. Mach-O supports both 32-bit and 64-bit variants and multiple architectures in a single file (fat or universal binaries) through a fat header.

A Mach-O file begins with a header that identifies the architecture, file type (executable, dylib, bundle, object),

The format supports universal binaries containing multiple architectures in a single file. Apple toolchain tools such

and
the
number
of
load
commands.
After
the
header
are
a
sequence
of
load
commands,
which
describe
segments
and
sections,
as
well
as
dynamic
libraries
to
load,
symbol
tables,
and
entry
points.
Segments
contain
sections
that
hold
code,
data,
or
other
resources.
The
dynamic
linker
(dyld)
uses
the
load
commands
to
map
the
image
into
memory
and
to
resolve
symbols
at
load
time
or
run
time.
Mach-O
supports
position-independent
code,
code
signing,
and
address
space
layout
randomization.
as
lipo,
otool,
nm,
install_name_tool,
and
codesign
operate
on
Mach-O
files.
The
format
remains
the
primary
binary
for
macOS
and
iOS
applications
and
libraries,
with
dyld
as
the
dynamic
linker.