The Nitty Gritty of “Hello World” on macOS

A walkthrough of the Mach-O file format using a compiled Hello World program.

Author
Joe Savage
Published
8 November 2014
Kind
Personal blog walkthrough, based on hands-on inspection of one binary
Original
www.reinterpretcast.com/hello-world-mach-o
Subject
Systems and hardware
Themes
Close to the machine, Getting good

What it is

Joe Savage wanted to learn how executables talk to the operating system. The post records what the author found in a Hello World binary. It gives an outline and does not explain every byte.

What it says

What evidence it gives

The post shows otool output for the header. It describes the load commands and sections. It includes a colour visualisation of the file bytes. Claims about the loading process lean on Apple documentation and open source code.

Interests and limits

The test used one Late 2013 MacBook running Yosemite and an x86_64 binary. The post does not test newer systems or other chip types. The author calls the account a brief outline. Many parts of dynamic linking go uncovered.