I recently upgraded my Mac OS X 10.5 Leopard install to 10.6 Snow Leopard, and with that came an upgraded version of Python, 2.6.1 (instead if 2.5.1). Now when I type python in the Terminal i still get

Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04) 
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

I looked in /usr/bin/ and found that to get Python 2.6 I have to type python2.6.

The question is: How do I make the python command map to Python 2.6?

5 Answers 5


It’s easy:

defaults write com.apple.versioner.python Version 2.6

See man python for a complete explanation from Apple.

Also, one gotcha: make sure you are running the Python that came with your computer and not some other one that you installed. Do this by typing which python at your command prompt. It should point to /usr/bin/python. I only mention this because my default is 2.6 under Snow Leopard (it was 2.5 when I was using Leopard). So the fact that you are getting 2.5 may indicate that there’s something else in your path.


To address comments below:

This doesn’t do what people are asking.

It does for me, in OS X 10.8.2. After doing defaults write com.apple.versioner.python Version 2.6, the default version of Python is indeed 2.6. (And likewise after changing back to 2.7.)

This is true whether I run python directly, or use an executable script starting with #!/usr/bin/env python—I get the expected version of Python.

This does not solve the symlink in /System/Library/Frameworks/Python.framework/Versions where Current point to 2.7 which may cause problems (because it is still in the sys.path with 2.6 !)

Indeed, it doesn’t fix that symlink.

However, run a short script that print()s the sys.path and (at least on my relatively default setup) the 2.6 library directories are on the path and the 2.7 dirs are not on the path. Nor is the Current symlinked directory on the path. So it should not be a problem for most scripts.

However, it’s possible—haven’t tested—that the Current symlink is used by either easy_install or pip. That would cause problems. It sure does seem like a bug that the symlink isn’t updated when you update the Python version.

  • 3
    You were right. I had a long time ago installed MacPython and that screwed up my PATH variable so python pointed to /Library/Frameworks/Python.framework/Versions/Current/bin. Naturally that didn't get upgraded to 2.6. So I replaced my PATH variable with the default one I found on Google, and will now remove MacPython from my system.
    – SBSTN
    Sep 4, 2009 at 10:14
  • @SBSTN I've got the same problem (python path pointing to /Library/Frameworks/Python.framework/Versions/Current/bin) How do I change this?
    – Zach
    Mar 20, 2011 at 20:56
  • Doesn't work with Xcode4 as there's no /Library/Frameworks/Python* anymore nor does /usr/bin/python point anywhere else. Any ideas? MacPorts would be a solutions but I don't want to install it.
    – Alex
    May 11, 2011 at 8:27
  • I’ve installed Xcode 4 and it still works as described. /usr/bin/python is an executable, not a link. /usr/bin/python2.6 is a link that points to ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6. Given that the Python executable is in /System/Library it should be available regardless of whether/what version of Xcode is installed.
    – Nate
    May 11, 2011 at 23:52
  • This doesn't do what people are asking. Not sure why it's the answer.
    – 101010
    Jan 17, 2012 at 2:49

I would suggest using mac ports...

There is a package called python_select which allows using pythons in parallel. So first install mac ports if not already installed.

First install the python_select package:

sudo port install python_select

Already now you can check which python distributions are available on you system. Just issue the command:

port select --list python     (MacPorts 2.x)
python_select -l              (MacPorts 1.x)

In my case it printed at least python version which comes by default with Snow Leopard: python26-apple.

port select --show python     (MacPorts 2.x)
python_select -s              (MacPorts 1.x)

shows the currently selected version, e.g. python26-apple. So you see, this package nicely plays with Mac. For more options issue

port select                   (MacPorts 2.x)
python_select -h              (MacPorts 1.x)

Than you can search for available python version in the ports repository:

port search python

This will produce a long list will available pythons.

To install the desired packages, e.g. python 2.4 execute:

sudo port install python24

Now the python_select -s will show the freshly installed python as well. To switch to python 2.4 issue:

sudo port select --set python python24  (MacPorts 2.x)
sudo python_select python24             (MacPorts 1.x)

This command is persistent between shells.


Assuming you're using bash, type:

% type -a python

That will show you all "python" executables, aliases, shell builtins (likely none) or bash functions in your PATH.

This should help you better identify what's going on here.


You want to create a symlink to the desired version.

cd /Library/Frameworks/Python.framework/Versions 
sudo rm Current 
sudo ln -s /Library/Frameworks/Python.framework/Versions/2.6 Current

This removes the current pointer to your default Python version and sets it to your 2.6 version.

  • 1
    This is similar to what I did. But instead I put the link in /usr/bin and called it "python" (overriding the old "python" executable that Apple put there). So: sudo ln -s /path/to/2.7 /usr/bin/python. This is the way it is done in Linux and it just makes sense.
    – Nacht
    Nov 9, 2012 at 20:51

Not ideal (IMO), but this fixed all the apps looking for python in my /usr/local/bin/.

sudo cp /usr/local/bin/python3 /usr/local/bin/python

Of course, after installing the latest Python version.

  • this is really bad idea. Using symlink can be understood, but copying binaries back and forth is NOT a good idea.
    – Jakuje
    Dec 29, 2015 at 18:10
  • Understood, I just want to type python in terminal and have it point to Python3.x... not too late to fix this properly.
    – AGDM
    Dec 29, 2015 at 21:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .