Reduce application size?
Is there any way to reduce the size of a standalone application? I’ve just made one from a simple enough patch – 102Mb!!!
I posted the same question a few days ago. I didn’t get any replies but here’s what I’ve been able to determine on my own (under Mac OS) and from the documentation:
A basic standalone has grown from around 30 MB (Max 5) to 100 MB (Max 6).
When you build a standalone, your patcher is saved as a collective along with the Max 6 runtime application and other frameworks and resources. The executable binary in Max 6 runtime has grown in size: 27.3 MB (compared to 12.7 MB under Max 5). Unless you have a friend at Cycling ’74 who could give you a custom compile of a lightweight Max, you’ll just have to live with bigger standalones.
Two things, however, can help reduce the overall size up to 60%, depending on what your standalone needs to run:
**Save 50 MB** Include the standalone object in your top-level patcher and in the inspector, disable anything you don’t need. Consider extensions, database, MIDI support and audio support.
**Save 12 MB** Control-click on the application to *Show Package Contents*. Consider junking any frameworks you don’t use, like JitterAPI.framework, MaxLua.framework and (possibly) libmozjs185.dylib (I assume it’s safe to remove these frameworks if you don’t access them – I have my doubts about libmozjs, though).
Anyway, those two steps alone reduce your standalone to under 40 MB. That’s about as good as it gets. Still too big? Well, a fully stripped standalone under Max 5 would be ~20 MB. You could also consider stripping out some interface files but that’s only going to save another 1-2 MB.
yes, Dan Nigrin was talking about that here – basically you need to remove what you don’t need manually. Read that : http://cycling74.com/toolbox/making-a-slick-max-standalone-presentation-from-expo-74-workshop/ (click "go to download site" to see hte slides) and this too : http://cycling74.com/2012/04/19/get-your-max-standalone-on-apple%E2%80%99s-mac-app-store/
Note also that since Max 6.1, the application (on mac) is fat: it contains both 32 and 64 architecture. If you don’t want to support that you can strip the architecture that you don’t need.
@Chris Rolfe: Not adding much to the knowledge on this topic, but I definitely posted a reply to your previous question. Just wondering if there is some kind of issue on the forum or maybe you just missed that. FWIW It happened about the same time the ordering of forum posts was all out of (temporal) order (for at least some users).
@Spectro: Oh, thanks… I’d overlooked it.
@Emmanuel Jourdan: Thanks, great tip.
Here’s what I did (in case anyone’s interested in smaller standalones). As above, I added the standalone object and remove unused Frameworks.
To strip the 32-bit binary, Show Package Contents and using terminal, cd into the MacOS directory. Then run lipo to create a 64-bit only copy:
lipo MyApp -thin x86_64 MyApp.x86_64
Delete the original executable and rename MyApp.x86_64 to MyApp. To create a 32-bit only version, you’d run:
lipo MyApp -thin i386 MyApp.i386
The final result was a standalone of 23.9 MB vs. the original 100+ MB.
Note, my understanding is that 64-bit is 10-20% larger but runs math routines slightly faster, so I opted for that. 64-bit is also supported on 10.5 and up.
Emmanuel, any corrections or caveats?
Thanks for the advice, all very helpful.
Forums > MaxMSP