Building macOS .dmg files

Applications on macOS are generally distributed inside a compressed disk image (.dmg) file. cx_Freeze allows you to go one step further and bundle your package into a DMG file directly.

This is done using bdist_dmg by executing the following command line:

python3 cxsetup.py bdist_dmg

This command runs bdist_mac and then packages the resulting bundle into a DMG file. The configuration options for bdist_dmg allow you to override the filename and include a shortcut to the /Applications directory for easy installation. The built file will appear in the build directory, and you can copy it from there to another Macintosh to be mounted and used.

Get Python GUI Programming with Tkinter now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.