Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Splitting a multi-architecture Mach-o binary

Tags:

ios

otool

mach-o

I've downloaded and decrypted (using dumpdecrypted) an iOS application from the app store (let's call it myApp). When I run "otool -arch all -Vh myApp", I get the following result:

myApp (architecture armv7):
Mach header
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
   MH_MAGIC     ARM         V7  0x00     EXECUTE    76       7140   NOUNDEFS DYLDLINK TWOLEVEL WEAK_DEFINES BINDS_TO_WEAK PIE
myApp (architecture arm64):
Mach header
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
MH_MAGIC_64   ARM64        ALL  0x00     EXECUTE    76       7888   NOUNDEFS DYLDLINK TWOLEVEL WEAK_DEFINES BINDS_TO_WEAK PIE

I would like to be able to split the binary file into two files, one per each architecture. I guess it can be done by parsing the Mach-o headers, but I couldn't figure out how.

Thanks.

like image 873
nozik Avatar asked Feb 23 '26 16:02

nozik


1 Answers

The easiest way is to use lipo and the command line option -thin. E.g.

lipo -thin armv7 -output myApp_armv7 myApp
like image 160
Mats Avatar answered Feb 25 '26 06:02

Mats