Making smaller OS X app bundles with Py2App

I have a relatively simple wxPython app that talks to a serial port. It
has a few buttons, and input text control and an output text control.

When I use py2app to create a standalone app bundle, the size of the app
bundle is 45MB !!!
This seems very large to me for a simple application.
Maybe 45MB is reasonable ???

I listed all the files of the app bundle in size order. The last 5
files are below.

    -rwxr-xr-x 1 brendan brendan 2.2M 26 Jun 13:41
    dist/sureshotgps.app/Contents/Frameworks/libwx_macud_stc-2.8.0.dylib
    -rw-r--r-- 1 brendan brendan 2.5M 26 Jun 13:41
    dist/sureshotgps.app/Contents/Resources/lib/python2.5/lib-dynload/wx/_controls_.so
    -rwxr-xr-x 1 brendan brendan 2.6M 26 Jun 13:41
    dist/sureshotgps.app/Contents/Frameworks/Python.framework/Versions/2.5/Python
    -rw-r--r-- 1 brendan brendan 2.6M 26 Jun 13:41
    dist/sureshotgps.app/Contents/Resources/lib/python2.5/lib-dynload/wx/_core_.so
    -rwxr-xr-x 1 brendan brendan 20M 26 Jun 13:41
    dist/sureshotgps.app/Contents/Frameworks/libwx_macud-2.8.0.dylib

As can be seen the major contributor is a 20MB file called
libwx_macud-2.8.0.dylib, the files ranging from 2.6MB down exist.

Is there a way to make the app bundle standalone and smaller ???

Is it possible to split the 20MB dylib file into smaller dylib files and
include only the ones I need ???
Or extract only the internal library functions I need and put into a
smaller dylib file ???

Thanks, Brendan.

Hello,

I have a relatively simple wxPython app that talks to a serial port. It
has a few buttons, and input text control and an output text control.

When I use py2app to create a standalone app bundle, the size of the app
bundle is 45MB !!!
This seems very large to me for a simple application.
Maybe 45MB is reasonable ???

Yes this is right. Remember that there are two architectures bundled into these libraries.

As can be seen the major contributor is a 20MB file called
libwx_macud-2.8.0.dylib, the files ranging from 2.6MB down exist.

Is there a way to make the app bundle standalone and smaller ???

You can use Disk Utility to create a dmg file and compress it down to less than 20MB.

If you don't need your app to run on PPC computers you can use TrimTheFat or similar app to strip the ppc other code from binaries.

You could rebuild your own wxWidgets/wxPython without debug symbols and disable library features that you don't need.

Is it possible to split the 20MB dylib file into smaller dylib files and
include only the ones I need ???

You would need to rebuild wxWidgets without the monolithic flag, but last I checked there used to be some issues with doing this on OSX.

Or extract only the internal library functions I need and put into a
smaller dylib file ???

No, and I don't think it would really be worth the effort to go this far, would be better to re-write your app in cocoa if you need to get it to be even smaller.

Cody

···

On Jun 28, 2009, at 8:33 AM, Brendan Simon (eTRIX) wrote: