Skip to main content

Create standalone Mac OS X applications with Python

Project description

py2app is a Python setuptools command which will allow you to make standalone Mac OS X application bundles and plugins from Python scripts.

py2app is similar in purpose and design to py2exe for Windows.

Release history

py2app 0.6.1

py2app 0.6.1 is a bugfix release


  • py2app failed to build the bundle when python package contained a zipfile with data.

    This version solves most of that problem using a rough workaround (the issue is fixed when the filename ends with ‘.zip’).

  • The code that recreates the stub executables when they are older than the source code now uses xcode-select to find the root of SDKs.

    This makes it possible to recreate these executables on machines where both Xcode 3 and Xcode 4 are installed and Xcode 3 is the default Xcode.

  • The stub executables were regenerated using Xcode 3

    As a word of warning: Xcode 4 cannot be used to rebuild the stub executables, in particular not those that have support for the PPC architecture.

  • Don’t rebuild the stub executables automaticly, that’s unsafe with Xcode 4 and could trigger accidently when files are installed in a different order than expected.

  • Small tweaks to the testsuite to ensure that they work on systems with both Xcode3 and Xcode4 (Xcode3 must be the selected version).

  • Better cleanup in the testsuite when setupClass fails.

py2app 0.6

py2app 0.6 is a minor feature release


  • it is now possible to specify which python distributions must be availble when building the bundle by using the “install_requires” argument of the setup() function:

        install_requires = [
               "pyobjc == 2.2"
  • py2app can now package namespace packages that were installed using pip <> or the setuptools install option --single-version-externally-managed.

  • the bundle template now supports python3, based on a patch by Virgil Dupras.

  • alias builds no longer use Carbon Aliases and therefore are supported with python3 as well (patch by Virgil Dupras)

  • argv emulation doesn’t work in python 3, this release will tell you abou this instead of silently failing to build a working bundle.

  • add support for custom URLs to the argv emulation code (patch by Brendan Simon).

    You will have to add a “CFBundleURLTypes” key to your Info.plist to use this, the argv emulation code will ensure that the URL to open will end up in sys.argv.

  • py2app.util contains a number of functions that are now deprecated an will be removed in a future version, specifically: os_path_islink, os_path_isdir, path_to_zip, get_zip_data, get_mtime, and os_readlink.

  • The module py2app.simpleio no longer exists, and should never have been in the repository (it was part of a failed rewrite of the I/O layer).

Bug fixes:

  • fix problem with symlinks in copied framework, as reported by Dan Ross.
  • py2applet didn’t work in python 3.x.
  • The --alias option didn’t work when building a plugin bundle (issue #10, fix by Virgil Dupras)
  • Avoid copying the __pycache__ directory in python versions that implement PEP 3147 (Python 3.2 and later)
  • App bundles with Python 3 now work when the application is stored in a directory with non-ASCII characters in the full name.
  • Do not compile .nib files, it is not strictly needed and breaks PyObjC projects that still use the NibClassBuilder code.
  • Better error messsages when trying to include a non-existing file as a resource.
  • Don’t drop into PDB when an exception occurs.
  • Issue #5: Avoid a possible stack overflow in the bundle executable
  • Issue #9: Work with python 3.2
  • Fix build issues with python 2.5 (due to usage of too modern distutils command subclasses)
  • The source distribution didn’t include all files that needed to be it ever since switching to mercurial, I’ve added a file rather than relying on setuptool’s autoguessing of files to include.
  • Bundle template works again with semi-standalone builds (such as when using a system python), this rewrites the fix for issue #10 mentioned earlier.
  • Ensure py2app works correctly when the sources are located in a directory with non-ascii characters in its name.

py2app 0.5.2

py2app 0.5.2 is a bugfix release

Bug fixes:

  • Ensure that the right stub executable gets found when using the system python 2.5

py2app 0.5.1

py2app 0.5.1 is a bugfix release

Bug fixes:

  • Ensure stub executables get included in the egg files
  • Fix name of the bundletemplate stub executable for 32-bit builds

py2app 0.5

py2app 0.5 is a minor feature release.


  • Add support for the --with-framework-name option of Python’s configure script, that is: py2app now also works when the Python framework is not named ‘Python.framework’.
  • Add support for various build flavours of Python (32bit, 3-way, …)
  • py2app now actually works for me ( with a python interpreter in a virtualenv environment.
  • Experimental support for python 3

Bug fixes:

  • Fix recipe for matplotlib: that recipe caused an exception with current versions of matplotlib and pytz.
  • Use modern API’s in the alias-build bootstrap code, without this ‘py2app -A’ will result in broken bundles on a 64-bit build of Python. (Patch contributed by James R Eagan)
  • Try both ‘import Image’ and ‘from PIL import Image’ in the PIL recipe. (Patch contributed by Christopher Barker)
  • The stub executable now works for 64-bit application bundles
  • (Lowlevel) The application stub was rewritten to use dlopen instead of dyld APIs. This removes deprecation warnings during compilation.

py2app 0.4.3

py2app 0.4.3 is a bugfix release

Bug fixes:

  • A bad format string in made it impossible to copy the Python framework into an app bundle.

py2app 0.4.2

py2app 0.4.2 is a minor feature release


  • When the ‘–strip’ option is specified we now also remove ‘.dSYM’ directories from the bundle.
  • Remove dependency on a ‘version.plist’ file in the python framework
  • A new recipe for PyQt 4.x. This recipe was donated by Kevin Walzer.
  • A new recipe for virtualenv, this allows you to use py2app from a virtual environment.
  • Adds support for converting .xib files (NIB files for Interface Builder 3)

  • Introduces an experimental plugin API for data converters.

    A conversion plugin should be defined as an entry-point in the py2app.converter group:

       entry_points = {
               'py2app.converter': [
                   "label          = some_module:converter_function",

    The conversion function should be defined like this:

    from py2app.decorators import converts
    def optimze_png(source, proposed_destionation, dryrun=0):
       # Copy 'source' to 'proposed_destination'
       # The conversion is allowed to change the proposed
       # destination to another name in the same directory.

Buf fixes:

  • This fixes an issue with copying a different version of Python over to an app/plugin bundle than the one used to run py2app with.

py2app 0.4.0

py2app 0.4.0 is a minor feature release (and was never formally released).


  • Support for CoreData mapping models (introduced in Mac OS X 10.5)
  • Support for python packages that are stored in zipfiles (such as zip_safe python eggs).

Bug fixes:

  • Fix incorrect symlink target creation with an alias bundle that has included frameworks.
  • Stuffit tends to extract archives recursively, which results in unzipped code archives inside py2app-created bundles. This version has a workaround for this “feature” for Stuffit.
  • Be more carefull about passing non-constant strings as the template argumenti of string formatting functions (in the app and bundle templates), to avoid crashes under some conditions.

py2app 0.3.6

py2app 0.3.6 is a minor bugfix release.

Bug fixes:

  • Ensure that custom icons are copied into the output bundle
  • Solve compatibility problem with some haxies and inputmanager plugins

py2app 0.3.5

py2app 0.3.5 is a minor bugfix release.

Bug fixes:

  • Resolve disable_linecache issue
  • Fix Info.plist and Python path for plugins

py2app 0.3.4

py2app 0.3.4 is a minor bugfix release.

Bug fixes:

  • Fixed a typo in the py2applet script
  • Removed some, but not all, compiler warnings from the bundle template (which is still probably broken anyway)

py2app 0.3.3

py2app 0.3.3 is a minor bugfix release.

Bug Fixes:

  • Fixed a typo in the argv emulation code
  • Removed the unnecessary py2app.install hack (setuptools does that already)

py2app 0.3.2

py2app 0.3.2 is a major bugfix release.

Functional changes:

  • Massively updated documentation
  • New prefer-ppc option
  • New recipes: numpy, scipy, matplotlib
  • Updated py2applet script to take options, provide –make-setup

Bug Fixes:

  • No longer defaults to LSPrefersPPC
  • Replaced stdlib usage of argvemulator to inline version for i386 compatibility

py2app 0.3.1

py2app 0.3.1 is a minor bugfix release.

Functional changes:

  • New EggInstaller example

Bug Fixes:

  • Now ensures that the executable is +x (when installed from egg this may not be the case)

py2app 0.3.0

py2app 0.3.0 is a major feature enhancements release.

Functional changes:

  • New –xref (-x) option similar to py2exe’s that produces a list of modules and their interdependencies as a HTML file
  • sys.executable now points to a regular Python interpreter alongside the regular executable, so spawning sub-interpreters should work much more reliably
  • Application bootstrap now detects paths containing “:” and will provide a “friendly” error message instead of just crashing <>.
  • Application bootstrap now sets PYTHONHOME instead of a large PYTHONPATH
  • Application bootstrap rewritten in C that links to CoreFoundation and Cocoa dynamically as needed, so it doesn’t imply any particular version of the runtime.
  • Documentation and examples changed to use setuptools instead of distutils.core, which removes the need for the py2app import
  • Refactored to use setuptools, distributed as an egg.
  • macholib, bdist_mpkg, modulegraph, and altgraph are now separately maintained packages available on PyPI as eggs
  • macholib now supports little endian architectures, 64-bit Mach-O headers, and reading/writing of multiple headers per file (fat / universal binaries)

py2app 0.2.1

py2app 0.2.1 is a minor bug fix release.

Bug Fixes:

  • macholib.util.in_system_path understands SDKs now
  • DYLD_LIBRARY_PATH searching is fixed
  • Frameworks and excludes options should work again.

py2app 0.2.0

py2app 0.2.0 is a minor bug fix release.

Functional changes:

  • New datamodels option to support CoreData. Compiles .xcdatamodel files and places them in the Resources dir (as .mom).
  • New use-pythonpath option. The py2app application bootstrap will no longer use entries from PYTHONPATH unless this option is used.
  • py2app now persists information about the build environment (python version, executable, build style, etc.) in the Info.plist and will clean the executable before rebuilding if anything at all has changed.
  • bdist_mpkg now builds packages with the full platform info, so that installing a package for one platform combination will not look like an upgrade to another platform combination.

Bug Fixes:

  • Fixed a bug in standalone building, where a rebuild could cause an unlaunchable executable.
  • Plugin bootstrap should compile/link correctly with gcc 4.
  • Plugin bootstrap no longer sets PYTHONHOME and will restore PYTHONPATH after initialization.
  • Plugin bootstrap swaps out thread state upon plug-in load if it is the first to initialize Python. This fixes threading issues.

py2app 0.1.9

py2app 0.1.9 is a minor bug fix release.

Bugs fixed:

  • bdist_mpkg now builds zip files that are correctly unzipped by all known tools.
  • The behavior of the bootstrap has changed slightly such that __file__ should now point to your main script, rather than the bootstrap. The main script has also moved to Resources, from Resources/Python, so that __file__ relative resource paths should still work.

py2app 0.1.8

py2app 0.1.8 is a major enhancements release:

Bugs fixed:

  • Symlinks in included frameworks should be preserved correctly (fixes Tcl/Tk)
  • Fixes some minor issues with alias bundles
  • Removed implicit SpiderImagePlugin -> ImageTk reference in PIL recipe
  • The --optimize option should work now
  • weakref is now included by default
  • anydbm’s dynamic dependencies are now in the standard implies list
  • Errors on app launch are brought to the front so the user does not miss them
  • bdist_mpkg now compatible with pychecker (data_files had issues)

Options changed:

  • deprecated --strip, it is now on by default
  • new --no-strip option to turn off stripping of executables

New features:

  • Looks for a hacked version of the PyOpenGL so that it doesn’t have to include the whole package in order to get at the stupid version file.
  • New loader_files key that a recipe can return in order to ensure that non-code ends up in the .zip (the pygame recipe uses this)
  • Now scans all files in the bundle and normalizes Mach-O load commands, not just extensions. This helps out when using the --package option, when including frameworks that have plugins, etc.
  • An embedded Python interpreter is now included in the executable bundle (sys.executable points to it), this currently only works for framework builds of Python
  • New macho_standalone tool
  • New macho_find tool
  • Major enhancements to the way plugins are built
  • bdist_mpkg now has a --zipdist option to build zip files from the built package
  • The bdist_mpkg “Installed to:” description is now based on the package install root, rather than the build root

py2app 0.1.7

py2app 0.1.7 is a bug fix release:

  • The bdist_mpkg script will now set up sys.path properly, for setup scripts that require local imports.
  • bdist_mpkg will now correctly accept ReadMe, License, Welcome, and background files by parameter.
  • bdist_mpkg can now display a custom background again (0.1.6 broke this).
  • bdist_mpkg now accepts a build-base= argument, to put build files in an alternate location.
  • py2app will now accept main scripts with a .pyw extension.
  • py2app’s not_stdlib_filter will now ignore a site-python directory as well as site-packages.
  • py2app’s plugin bundle template no longer displays GUI dialogs by default, but still links to AppKit.
  • py2app now ensures that the directory of the main script is now added to sys.path when scanning modules.
  • The py2app build command has been refactored such that it would be easier to change its behavior by subclassing.
  • py2app alias bundles can now cope with editors that do atomic saves (write new file, swap names with existing file).
  • macholib now has minimal support for fat binaries. It still assumes big endian and will not make any changes to a little endian header.
  • Add a warning message when using the install command rather than installing from a package.
  • New simple/structured example that shows how you could package an application that is organized into several folders.
  • New PyObjC/pbplugin Xcode Plug-In example.

py2app 0.1.6

Since I have been slacking and the last announcement was for 0.1.4, here are the changes for the soft-launched releases 0.1.5 and 0.1.6:

py2app 0.1.6 was a major feature enhancements release:

  • py2applet and bdist_mpkg scripts have been moved to Python modules so that the functionality can be shared with the tools.
  • Generic graph-related functionality from py2app was moved to altgraph.ObjectGraph and altgraph.GraphUtil.
  • bdist_mpkg now outputs more specific plist requirements (for future compatibility).
  • py2app can now create plugin bundles (MH_BUNDLE) as well as executables. New recipe for supporting extensions built with sip, such as PyQt. Note that due to the way that sip works, when one sip-based extension is used, all sip-based extensions are included in your application. In practice, this means anything provided by Riverbank, I don’t think anyone else uses sip (publicly).
  • New recipe for PyOpenGL. This is very naive and simply includes the whole thing, rather than trying to monkeypatch their brain-dead version acquisition routine in __init__.
  • Bootstrap now sets ARGVZERO and EXECUTABLEPATH environment variables, corresponding to the argv[0] and the _NSGetExecutablePath(...) that the bundle saw. This is only really useful if you need to relaunch your own application.
  • More correct dyld search behavior.
  • Refactored macholib to use altgraph, can now generate GraphViz graphs and more complex analysis of dependencies can be done.
  • macholib was refactored to be easier to maintain, and the structure handling has been optimized a bit.
  • The few tests that there are were refactored in py.test style.
  • New PyQt example.
  • New PyOpenGL example.

See also:

py2app 0.1.5

py2app 0.1.5 is a major feature enhancements release:

  • Added a bdist_mpkg distutils extension, for creating Installer an metapackage from any distutils script.
    • Includes PackageInstaller tool
    • bdist_mpkg script
    • enhancements to support bdist_mpkg functionality
  • Added a PackageInstaller tool, a droplet that performs the same function
    as the bdist_mpkg script.
  • Create a custom bdist_mpkg subclass for py2app’s setup script.
  • Source package now includes PJE’s setuptools extension to distutils.
  • Added lots of metadata to the setup script.
  • py2app.modulegraph is now a top-level package, modulegraph.
  • py2app.find_modules is now modulegraph.find_modules.
  • Should now correctly handle paths (and application names) with unicode characters in them.
  • New --strip option for py2app build command, strips all Mach-O files in output application bundle.
  • New --bdist-base= option for py2app build command, allows an alternate build directory to be specified.
  • New docutils recipe. Support for non-framework Python, such as the one provided by DarwinPorts.

See also:

py2app 0.1.4

py2app 0.1.4 is a minor bugfix release:

  • The altgraph from 0.1.3 had a pretty nasty bug in it that prevented filtering from working properly, so I fixed it and bumped to 0.1.4.

py2app 0.1.3

py2app 0.1.3 is a refactoring and new features release:

  • altgraph, my fork of Istvan Albert’s graphlib, is now part of the distribution
  • py2app.modulegraph has been refactored to use altgraph
  • py2app can now create GraphViz DOT graphs with the -g option (TinyTinyEdit example)
  • Moved the filter stack into py2app.modulegraph
  • Fixed a bug that may have been in 0.1.2 where explicitly included packages would not be scanned by macholib
  • py2app.apptemplate now contains a stripped down site module as opposed to a sitecustomize
  • Alias builds are now the only ones that contain the system and user site-packages directory in sys.path
  • The pydoc recipe has been beefed up to also exclude BaseHTTPServer, etc.

Known issues:

  • Commands marked with XXX in the help are not implemented
  • Includes all files from packages, it should be smart enough to strip unused .py/.pyc/.pyo files (to save space, depending on which optimization flag is used)
  • macholib should be refactored to use altgraph
  • py2app.build_app and py2app.modulegraph should be refactored to search for dependencies on a per-application basis

py2app 0.1.2

py2app 0.2 is primarily a bugfix release:

  • The encodings package now gets included in the zip file (saves space)
  • A copy of the Python interpreter is not included anymore in standalone builds (saves space)
  • The executable bootstrap is now stripped by default (saves a little space)
  • sys.argv is set correctly now, it used to point to the executable, now it points to the boot script. This should enhance compatibility with some applications.
  • Adds an “Alias” feature to modulegraph, so that sys.modules craziness such as wxPython.wx -> wx can be accomodated (this particular craziness is also now handled by default)
  • A sys.path alternative may be passed to find_modules now, though this is not used yet
  • The Command instance is now passed to recipes instead of the Distribution instance (though no recipes currently use either)
  • The post-filtering of modules and extensions is now generalized into a stack and can be modified by recipes
  • A wxPython example demonstrating how to package wxGlade has been added (this is a good example of how to write your own recipe, and how to deal with complex applications that mix code and data files)
  • PyRuntimeLocations is now set to (only) the location of the current interpreter’s Python.framework for alias and semi-standalone build modes (enhances compatibility with extensions built with an unpatched Makefile with Mac OS X 10.3’s Python 2.3.0)

Known issues:

  • Includes all files from packages, it should be smart enough to strip unused .py/.pyc/.pyo files (to save space, depending on which optimization flag is used).

py2app 0.1.1

py2app 0.1.1 is primarily a bugfix release:

  • Several problems related to Mac OS X 10.2 compatibility and standalone
    building have been resolved
  • Scripts that are not in the same directory as now work
  • A new recipe has been added that removes the pydoc -> Tkinter dependency
  • A recipe has been added for py2app itself
  • a wxPython example (superdoodle) has been added. Demonstrates not only how easy it is (finally!) to bundle wxPython applications, but also how one can deal with both py2exe and py2app.
  • A new experimental tool, py2applet, has been added. Once you’ve built it (python py2app, of course), you should be able to build simple applications simply by dragging your main script and optionally any packages, data files, Info.plist and icon it needs.

Known issues:

  • Includes all files from packages, it should be smart enough to strip unused .py/.pyc/.pyo files (to save space, depending on which optimization flag is used).
  • The default PyRuntimeLocations can cause problems on machines that have a /Library/Frameworks/Python.framework installed. Workaround is to set a plist that has the following key: PyRuntimeLocations=['/System/Library/Frameworks/Python.framework/Versions/2.3/Python'] (this will be resolved soon)

py2app 0.1

(first public release) py2app is the bundlebuilder replacement we’ve all been waiting for. It is implemented as a distutils command, similar to py2exe.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for py2app, version 0.6.1
Filename, size File type Python version Upload date Hashes
Filename, size py2app-0.6.1.tar.gz (783.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page