binary_size
Analyze a compiled Mach-O binary to get a detailed size breakdown by segment and section. This tool helps you understand what contributes to your app’s executable size, identify bloated sections, and track size changes across builds. It reads the binary’s load commands and section headers to produce a human-readable report.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
binaryPath | string | Yes | — | Absolute path to the Mach-O binary executable to analyze |
Usage Examples
Section titled “Usage Examples”Analyze the main app binary
Section titled “Analyze the main app binary”“Show me the size breakdown of my FitnessTracker binary”
{ "binaryPath": "/Users/dev/Library/Developer/Xcode/DerivedData/FitnessTracker-abc123/Build/Products/Release-iphoneos/FitnessTracker.app/FitnessTracker"}Analyze a framework binary
Section titled “Analyze a framework binary”“Check the binary size of the Charts framework”
{ "binaryPath": "/Users/dev/Library/Developer/Xcode/DerivedData/FitnessTracker-abc123/Build/Products/Release-iphoneos/FitnessTracker.app/Frameworks/Charts.framework/Charts"}Analyze an archived binary
Section titled “Analyze an archived binary”“Analyze the binary size from my latest archive”
{ "binaryPath": "/Users/dev/Library/Developer/Xcode/Archives/2025-01-15/FitnessTracker.xcarchive/Products/Applications/FitnessTracker.app/FitnessTracker"}Example Output
Section titled “Example Output”Binary Analysis: FitnessTrackerPath: /Users/dev/.../FitnessTracker.app/FitnessTrackerArchitecture: arm64
Segment Breakdown: __TEXT 8.4 MB __text 6.1 MB (code) __stubs 48.0 KB (symbol stubs) __stub_helper 42.5 KB (stub helpers) __objc_methname 512.0 KB (method names) __cstring 384.0 KB (C strings) __swift5_typeref 256.0 KB (Swift type references) __swift5_reflstr 198.0 KB (Swift reflection strings) __const 840.0 KB (constants)
__DATA 2.1 MB __objc_classlist 64.0 KB (ObjC classes) __objc_protolist 12.0 KB (ObjC protocols) __objc_const 680.0 KB (ObjC constants) __data 320.0 KB (data) __bss 512.0 KB (uninitialized data) __common 48.0 KB (common symbols)
__LINKEDIT 3.7 MB Symbol table 1.2 MB String table 1.8 MB Code signature 700.0 KB
Total Binary Size: 14.2 MBRelated Tools
Section titled “Related Tools”ipa_analyze— Analyze the full IPA including frameworks and resources, not just the binarydsym_verify— Verify the dSYM matches this binary for symbolicationxcode_build— Build the project to produce the binary for analysis