Thursday, February 12, 2009

Installing Python on Mac OS X (Leopard)

Mac OS X 10.5.x (Leopard) comes with Python 2.5.1 pre-installed. However this installation is without the IDLE.app, the need for IDLE.app comes in if you are interested in a light-weight Python development (Leopard's Xcode 3.0 allows working with Python though...)

To install IDLE.app and other Python 2.5 extras,
  1. Download the installer from http://pythonmac.org/packages/py25-fat/dmg/python-2.5-macosx.dmg (approximately 18MB)
  2. Mount the disk image.
  3. Do a "Show Package Contents" on the MacPython.mpkg (context-click / control-click the package)
  4. Backup your .bash_profile before you install.
  5. Navigate to Contents > Packages > PythonApplications-2.5.pkg, double click to install. This would install the extras including IDLE.app. They would be installed in the Applications/MacPython 2.5 folder.
  6. Using Terminal, create a symbolic link for the system's Python.framework in the location expected by the pythonmac.org tools:
    cd /Library/Frameworks

    sudo ln -s /System/Library/Frameworks/Python.framework/ Python.framework
It is recommended that you delete the newly installed Python Launcher.app, because it is already present inside the system Python.framework.
If you have installed Apple's developer tools (Xcode et al), it is recommended that you delete the newly installed Build Applet.app, because it is already present in /Developer/Applications/Utilities/MacPython 2.5.


For more information:
http://wiki.python.org/moin/MacPython/Leopard
http://python.org/download/mac/

No comments: