Revision 17 as of 2006-03-10 18:02:40

Clear message

Much of this page is wildly out of date and/or wrong (a common problem with Wikis).

Please see [http://www.python.org/download/mac/ the regular Macintosh Python download page] for more up-to-date information.

Welcome to the MacPython Wiki page. MacPython is much more than just a port of Python to the Mac, it includes many Mac-specific tools and modules that make developing Mac applications using Python very easy, and dare I say fun! (Note that most of this information is specific to MacPython on OS X, which is now the actively maintained and developed port.). Many of these tools can be found in the /Applications/MacPython-2.3 folder.

This wiki page is for emerging documentation for all the new Mac-specific tools and modules being developed thanks to great support by the MacPython community. In addition to this wiki page, you can find information on Python on the Macintosh at http://www.cwi.nl/~jack/macpython. Installers, documentation and much more is available there too. A Mac help file is also available from the MacPythonIDE and can be accessed by clicking on the Help menu, and selecting Mac-specific help.

MacPython Tools

These tools come "out of the box" with every MacPython installation and make developing on MacPython a breeze.

Downloading and Installing Modules

When downloading packages for Mac, in addition to the traditional method of downloading from source and running setup.py, you could use the Python PackageManager in former times.

Please note that PackageManager is no longer supported and won't work for current MacPython / Mac OS X combinations. If you intend to install additional modules, have a look at the MacPython module archive at http://www.pythonmac.org/packages and download the packages available there.

Sidenote: for Mac OS X 10.4 you can install all modules from the 10.4 and the 10.3+ sections as long as they match the MacPython version on your machine.

Developing on Mac

There's a MacPythonIDE which provides script building, debugging, and other services. Check out the tutorial.

Distributing your App

There's a BuildApplet script that makes "applets" that look and feel like traditional Mac programs. Just drop your script onto BuildApplet! However, these applets still require MacPython to be installed. You can also create standalone application bundles that do not require MacPython on the user's machine using the BundleBuilder script.

Mac-specific modules

There are also a number of modules which allow developers to access Mac-specific functionality from MacPython.

Want to script AppleScript-enabled Mac applications from Python?

Check out the aeve module, which lets you generate Python 'wrappers' for AppleScript-enabled programs.

You can get it here: http://undefined.org/python/

Want to write GUI apps for Mac?

If you want to develop GUIs for Mac only, you can directly access the Carbon module. Carbon support is built into the MacPython package. There's also PyObjC, which gives you access to the Cocoa framework from Python. PyObjC can be found here: http://pyobjc.sourceforge.net/

If you want a cross-platform application, WxPython runs on Mac as well. WxPython is available from http://www.wxpython.org/

Need to run Mac programs and scripts from Python?

Check out the LaunchServices module, which lets you load programs, or even URLs, from Python. It's got a ton of other useful features dealing with paths, applications, urls, creator codes, etc. It can be found at: http://undefined.org/python/

Wiki ToDo

(We should add pages about PyObjC / PythonCocoa, AppleEvents or AppleScript, CarbonApi, MacPythonIde, etc. Please expand. But first: should we use a "Mac" prefix for all MacPython-related wiki words? Kevin: I think it's OK not to use the Mac prefix except when referring to MacPython itself, like MacPythonIDE. Mac modules and such should use unique names anyways to avoid confusion and conflicts with counterparts on other platforms.)

How to Make FSSpec's

This should probably be somewhere else, but it's too useful to wait until I can figure out where that would be. (Note: I have only tried this in Python 2.3)

   1 from Carbon import File
   2 spec = File.FSSpec('/normal/slash/based/unix/path/string')

That's ALL! Don't muck around with FSMakeFSSpec or CFURL or any of that stuff. I found this [http://mail.python.org/pipermail/pythonmac-sig/2003-March/007459.html on the pythonmac-SIG list].

Unable to edit the page? See the FrontPage for instructions.