OS X supports a number of application environments, each with its own runtime rules, conventions, and file formats. In OS X, kernel extensions, command-line tools, applications, frameworks, and libraries (shared and static) are implemented using Mach-O (Mach object) files.

The OS X runtime architecture dictates how object files are laid out in the filesystem and how programs communicate with the kernel. The object file format used in OS X is Mach-O .

A Mach-O file has the following regions of data (the complete format is described in OS X ABI Mach-O File Format Reference):

The following list describes other runtime environments supported in OS X:

The Code Fragment Manager is documented in Mac OS Runtime Architectures, available from the Apple Developer Connection website.

This document discusses how you use the Mach-O file format. It describes what types of programs you can build, how programs are loaded and executed, how you can change the way programs are loaded and executed, how to load code at runtime, and how to load and link code at runtime. If you create or load bundles, shared libraries, or frameworks, you’ll probably want to read and understand everything in this document.

Who Should Read This Document

If you write development tools for OS X, you need to understand the information presented in this document.

This document is also useful for developers of shared libraries and frameworks, and for developers of applications that need to load code at runtime.

Organization of This Document

This document contains the following articles:

This document also contains a revision history and an index.

See Also

You can access full reference documentation for the standard command-line development tools using the man tool on the command line, or by choosing Open Man Page from the Xcode Help menu.

This document provides information on the Mach-O runtime architecture. It does not address the following:

Source code from the Darwin project can be downloaded from

You might also find the following books useful in conjunction with this document: