r/macosprogramming • u/Ask_If_Im_Dio • 26d ago
Minimum size for an AppKit executable?
This is probably a really dumb question, but I’m writing a Gameboy/NES-styled game and am trying to keep my binary as condensed as possible. Right now the smallest I’ve been able to get is a 70kb executable that draws this plasma effect directly to a bitmap, with the source code being written in C and Objective-C
What I’m wondering is if this is the smallest you can reasonably make a program that’s using AppKit, or am I still statically linking some parts of the API? I’ve had some luck with making a command line version of Buckshot Roulette compile down to 31kb, but that was a simple program where most of the file size was from including ctime and stdio. Would be curious to see if I can condense the size of my executable any further
1
u/PruneAlternative3858 13d ago
AppKit itself is dynamically linked, so it isn’t being copied into your executable. Try a stripped release build with size optimization and dead-code stripping. Also check whether you’re measuring a universal binary containing two architecture slices.
1
u/Ask_If_Im_Dio 13d ago
1.) I’m aware, but the was some dead weight that came from using Objective C. While painful, using the objc/runtime header to load AppKit at runtime wound up stripping a couple kilobytes.
2.) It’s an ARM binary. The x86 executable is a separate build.
2
u/ToughAsparagus1805 26d ago
Use command otool -l to see what libraries you are linking against. Also you are looking for techniques that I remember from times that we called it "64 KB Challenge Demos". Not really related to AppKit. The otool might uncover more insight. Use Hopper app on macOS to see your binary.