Fun with universal binaries

December 08, 2006

Yesterday I had to debug a Mac OSX program and therefore I had to learn about how Mac Universal Binaries work.

Universal Binaries contain (most of the time) PowerPC code and Intel x86 code as well. While they could easily also feature code for other architectures, like your toaster or microwave, it usually looks somewhat like this: [Header|PowerPC|Intel]. The operating system decides which code it needs and executes the part of the file suitable for its architecture.

Now in order to see what kind of binary information is "sandwiched" in the file, there is a header, very nicely described in the Mac OS X ABI Mach-O File Format Reference.

It starts off with a "magical number", that funnily reads 0xCAFEBABE in hexadecimal. -- Cafe babe? Yup.


Looks like the programmers had some fun coming up with a readable magic number. :)

For a more in-depth explanation of how universal binaries look like, I recommend this blog post.

(thanks to the t-shirt model ;) )

Was this helpful? Buy me a coffee with Bitcoin! (What is this?)

SQlite error: Unable to Open Database File

When writing a web app using an SQLite database file, you might run into an error where you can read from the file but not write to it......… Continue reading

Micro-tipping with Bitcoin

Published on November 27, 2014

setTimeout in Python

Published on November 14, 2014