in Projects, Programming, Technology

Getting started with Python on Mac OS X Tiger

I upgraded Python 2.3 to Python 2.5 on my Macbook, and changed some symbolic links so that 2.5 is the default version when run from the command line. In backwards order, here is what I did.

Python is pre-installed on Mac OS X Tiger, but what version am I running and where is it?

Open a terminal window (bash command shell) and type “python”

$ python
Python 2.5.2 (r252:60911, Jun  1 2008, 16:53:35)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin

I’m running 2.5 now, but I wasn’t earlier. Ok, where is Python installed?

$ which python

Is that the real location? No, it is a symbolic link.

$ ls -l /usr/bin/python*
lrwxr-xr-x   1 root  wheel      9 Jun 19 13:13 /usr/bin/python -> python2.5
lrwxr-xr-x   1 root  wheel     72 Oct 14  2006 /usr/bin/python2.3 -> ../../System/Library/Frameworks/Python.framework/Versions/2.3/bin/python
lrwxr-xr-x   1 root  wheel     82 Jun 19 13:15 /usr/bin/python2.5 -> /opt/local/var/macports/software/python25/2.5.2_2+darwin_8/opt/local/bin/python2.5

As you can see, I changed “python” to point to python2.5. Previously it pointed to python2.3.

Where can I get Python 2.5 for Mac OS X Tiger? I used macports.

$ port install python25

this will put it in /opt/local/var/macports

$ port location python25
Port python25 2.5.2_2+darwin_8 is installed as an image in:

Write a Comment


This site uses Akismet to reduce spam. Learn how your comment data is processed.

  1. Hi Adam,

    Thanks for this little write up. I’ve been going at installing apps via command line and I was having a heck of a time getting python to come up as 2.5.2, not 2.4.4 which I had previously installed. Do you know if I need to change my .bash_profile or .profile files to include a new PATH variable?