Mac binary stripping guide

Hey all. Mac users will know that a lot of new apples come with both i383 and ppc executable. If you’d like to save space you can strip one of them from the program. Here is how I did it to Safari 3.1:

First you open up Terminal.app under Utilities in the Applications directory.

Last login: Sun Mar 23 22:04:19 on ttyp1
Welcome to Darwin!
$ cd /Applications/Safari.app/Contents/MacOS/
$ ls
Safari
$ file Safari
Safari: Mach-O universal binary with 2 architectures
Safari (for architecture i386): Mach-O executable i386
Safari (for architecture ppc): Mach-O executable ppc
$ lipo -remove i386 Safari -output Safari
$ file Safari
Safari: Mach-O universal binary with 1 architecture
Safari (for architecture ppc): Mach-O executable ppc

For Intel users:
$ lipo -remove ppc Safari -output Safari

Explained:
The first two commands move you into the Safari.app binary and show you the contents of the folder. The file command shows you that the binary is a fat binary, IE it contains two arches.

Now lipo is the key to all of this. This is a command line tool that creates or operates on a universal files.

The binary you want to edit is located in Contents/MacOS inside the .app file. It is normally the only file in there.

Notes:
Backup the .app file before you begin just incase you make a mistake.
In firefox it’s called firefox-bin.
Tab-complete is your friend

Leave a Reply