Installing / Updating Python on OS X

Installing / Updating Python on OS X

While Python comes pre-installed on OS X, Apple doesn’t do a good job on keeping the Python runtime environment up to date. Currently, on Mac OS X 10.7.4 “Lion”, entering python -V returns Python 2.7.1. Even worse, Mac OS X 10.6 “Snow Leopard” is still on a Python 2.6 release.
While the latest Python releases are always available on, updating a Mac isn’t a simple, straight forward process.

Follow along and update your Mac to Python 2.7.3, or 3.3.0 or whatever the newest 2.x and 3.x release might be, when you read this. To update your Mac to something like Python 2.7.3, I assume that

  • your Mac-User account is setup as an “Administrator” account.
  • your Mac already has this folder: /System/Library/Frameworks/Python.framework/Versions/

To read about how to upgrade to Python 3.3, jump to the very bottom of this post.

1. Downloading and Installing the latest Python Release

Go to and pick the most recent Python 2.x release:
I picked Python 2.7.3 Mac OS X 64-bit/32-bit x86-64/i386 Installer (for Mac OS X 10.6 and later), an about 18 MB download.
Opening the DMG and executing the installer (Python.mpkg) will install the Python release into /Library/Frameworks/Python.framework, which is not next to the other, already installed Python versions and may lead to some nasty incompatibilities. Moreover, /usr/bin/python still executes python 2.7.1., i.e. some work still needs to be done to really update Python on your Mac.

2. Moving Python into the right place

If Python 2.7.x is already available on the Mac (e.g. on OS X Lion), open a terminal and enter:

sudo rm -R /System/Library/Frameworks/Python.framework/Versions/2.7

This will delete Python 2.7.
In any case, now enter this into the terminal

sudo mv /Library/Frameworks/Python.framework/Versions/2.7 /System/Library/Frameworks/Python.framework/Versions

which moves the just installed python 2.7.3 release next to the other Python releases.

3. Fixing the Group

Setting group to wheel, just like it’s done for the already installed Python Versions:

sudo chown -R root:wheel /System/Library/Frameworks/Python.framework/Versions/2.7

4. Updating the Current Link

sudo rm /System/Library/Frameworks/Python.framework/Versions/Current
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7 /System/Library/Frameworks/Python.framework/Versions/Current

5. Fixing /usr/bin

Since python, pythonw, etc. are not linked but actually reside in the /usr/bin directory,
/usr/bin/python still executes python 2.7.1..
Therefore, we are going to remove the old python executable files and replacing them with links into /System/Library/Frameworks/Python.framework/Versions/Current:

5.1. Removing old copies

sudo rm /usr/bin/pydoc
sudo rm /usr/bin/python
sudo rm /usr/bin/pythonw
sudo rm /usr/bin/python-config

5.2. Creating links into /System/…/Python.framework/Versions/Current

sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc /usr/bin/pydoc
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python /usr/bin/python
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw /usr/bin/pythonw
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python-config /usr/bin/python-config

6. Updating .bash_profile

Use TextMate, pico, or your favorite text editor to edit the hidden ~/.bash_profile file. If you want to be able to execute python tools like idle easily, without providing the path, edit the PATH for Python like this:

# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
export PATH

However, you can also remove those four lines altogether or fall-back to the .bash_profile.pysave file.
Try it by closing the terminal app, re-opening it, and entering python -V as well as /usr/bin/python -V.

7. Updating your IDE

The last remaining step it to tell your IDE about the new Python release that you just installed.
I hope you have discovered PyCharm, JetBrain’s IDE for Python and Django.
In PyCharm, you would open its properties and under “Project Interpreters” change the Python Interpreter, by pointing it to the /System/Library/Frameworks/Python.framework/Versions/2.7 directory.

Updating to Python 3.3

Following the same procedure, you can also update to Python 3.3. E.g, I downloaded the Python 3.3.0 Mac OS X 64-bit/32-bit x86-64/i386 Installer form here:

After running the included installer, a script like this (run with sudo) should put everything into the right place and make python 3.3 the default python version.

rm -R /System/Library/Frameworks/Python.framework/Versions/3.3
mv /Library/Frameworks/Python.framework/Versions/3.3 /System/Library/Frameworks/Python.framework/Versions
chown -R root:wheel /System/Library/Frameworks/Python.framework/Versions/3.3

rm /System/Library/Frameworks/Python.framework/Versions/Current
ln -s /System/Library/Frameworks/Python.framework/Versions/3.3 /System/Library/Frameworks/Python.framework/Versions/Current

rm /usr/bin/pydoc
rm /usr/bin/python
rm /usr/bin/pythonw
rm /usr/bin/python-config

rm /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pydoc 
rm /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python 
rm /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pythonw 
rm /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python-config 

ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pydoc3 /usr/bin/pydoc
ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python3 /usr/bin/python
ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pythonw3 /usr/bin/pythonw
ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python3-config /usr/bin/python-config


  1. Thank you for the upgrade pathway. I’m happily using Python 2.76. When I launch Idle, there is a message The version of Tcl/Tk (8.5.9) in use may be unstable. I’ve “installed” an updated version, but to no avail. The same message appears when launching Idle. Probably need to move something around using Unix. Could you folks help out?

    Thank you

  2. Thanks for detailed explanation, worked like a charm!

  3. I updated to python 3.3.5, python3.3.5 works well, but I can’t start idle.
    here is the error message:

    File “/usr/bin/idle”, line 31
    TabError: inconsistent use of tabs and spaces in indentation

    I try to run idle3, but there is another error message:

    -bash: /System/Library/Frameworks/Python.framework/Versions/3.3/bin/idle3: /Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3: bad interpreter: No such file or directory

  4. Everything works great on OSX 10.8.5, including IDLE. On an OSX.9.2 machine, Python installs, is launchable in the Terminal, but can’t get it to open in a separate window. Type in IDLE (after twice installing Active Tcl8. and get

    python version 2.7.6 can’t run /usr/bin/idle. Try the alternative(s):
    /usr/bin/idle2.7 (uses python 2.7)

    I’ve removed /usr/bin/idle2.5 and /usr/bin/idle2.6, so there should be no competing versions

    Any help here would be greatly appreciated.

  5. Does anyone here have IDLE working on OSX Mavericks? The instructions above work for installing Python 2.7.6, but IDLE does not work. I can confirm that it does work for 10.8.5. I can find the file for IDLE 2.7.6, but it does not execute in OSX 10.9.2. Can anyone here direct me to a resource that might address this?

    Thank you

  6. Recently upgraded from 2.7.2 to 3.4 – worked like a charm. Thanks for taking the time to do this for us.

  7. You are amazing. Thanks so much.

  8. I followed this guide to update my Mac OS X 10.6.8 Python to 2.7 but when trying to run easy_install I get the following error:
    hemmew7d01:checker-276 rtwmac$ easy_install pip
    python version 2.7.6 can’t run /usr/bin/easy_install. Try the alternative(s):

    /usr/bin/easy_install-2.5 (uses python 2.5)
    /usr/bin/easy_install-2.6 (uses python 2.6)

    Run “man python” for more information about multiple version support in
    Mac OS X.

    I only found a SO post that has the same problem after using this guide, but no solution:

    Any help is appreciated.

  9. Thank you for this! I followed the steps to upgrade to Python 3.3 but have two remaining problems:

    – When I try “which python” I still get 2.6.
    – Since the upgrade, I reinstalled a previously-installed package – Twython – using pip install. Pip told me the package was already installed (requirement already up to date) and shows it installed in the Versions/3.3/lib/python3.3/site-packages folder. Yet my code now throws an ImportError: No module named twython.

    What am I missing?

  10. similar error to posted above using python 3.4 on OS10.6:

    File "/usr/bin/easy_install", line 31
    TabError: inconsistent use of tabs and spaces in indentation

  11. I had a problem with my FTP program, Fetch after removing version 2.7 and upgrading to 3.4. It wouldn’t start. Installed 2.7.6 based on first set of instructions and Fetch works again. It was an issue with Carbon (as discovered in Console).

  12. Wolf, I understand completely why you did this, and I followed the instructions here. It’s a real pity Apple still doesn’t have a way to keep the Python runtime environment current.

    Heads up, though. If you do this and follow the instructions above, you will break Google Chrome automatic updates if you happen to use that browser, as many people do.

  13. Thank you very much, it worked like a charm.

  14. Installed Python 2.7.7 using installer provided at, which obviates need for the steps above. Symbolic links and removal of previous 2.7.x version performed during install. Version-appropriate Idle works fine from Terminal. Can’t launch either Python or Idle from dock, but this is not a problem for anyone comfortable with the command line. Can launch the multiple Python versions existing in OS 10.9.3 (2.5, 2.6, 2.7) or installed 3.4 in command line with pythonx.x. Tcl/Tk install without a hitch, as well. I am using BASH. Hope this is useful.

  15. Very clear and workable procedure. Thanks a lot. It helped me clean up the Python version mess on my Mac.

  16. Will this configuration get smashed with an upgrade to a newer version of OSX?

  17. THIS finally got me out of my Python mess! I installed a newer version, but TextMate was continuing to use the older one and Userlib2 was not compatible. This resulted in RESTful API request failing.

    This procedure not only helped me fix my problem BUT also helped me understand root cause.


  18. For OS X 10.9.3, I simply downloaded and installed Python 2.7.7 from After I opened a new shell , the default version of Python was 2.7.7

  19. Thanks. Explained to the point.

  20. Hi,

    I am relatively new to Python.

    I am using OS X 10.9.4. I have upgraded Python 3.4.1. And, when loaded Idle3 i am getting warning message

    WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable.
    Visit for current information.

    I have downloaded “ActiveTcl8.” from tried installed it but it is not working. Could you please advise if i can get any other alternate option to fix this issue and able to use idle3.

  21. Thanks so much for your simple instructions! I used this to update my terminal to Python 3.4, and the only thing I changed in the scripts was the ‘3.3’ to ‘3.4’

  22. Good One. Thanks.

  23. I just upgrading from 2.7 to 3.4. And it works.
    Thanks Paulus.

  24. I tried to update to my 2.7 version, but it deleted the default python on my mac. therefore I installed python 3.4 and tried to update it but it won’t update , although i can see the folder 3.4 in finder”No such file or directory”. Any help?

  25. Hi:

    It’s not that I want to update Python, but rather Python is using 100%+ of my CPU as per the Activity Monitor and I want it to stop — it’s slowing down everything.

    Any ideas?

    Please respond to my email to my email (

    Thank you,


  26. Can you update to show how to install 3.4.1? Link doesn’t apply anymore when upgrading from 3.3

  27. Hi everybody
    Will this work on osx 10.8.5? I somehow completely messed up default Python installation. can this be done via terminal?

    many thanks

  28. I keep getting a syntax error, even after copying and pasting

    >>> sudo rm -R /System/Library/Frameworks/Python.framework/Versions/2.7
    File “”, line 1
    sudo rm -R /System/Library/Frameworks/Python.framework/Versions/2.7
    SyntaxError: invalid syntax

  29. What about system utilities which may have dependencies on older versions being in place?

  30. @Saida — looks like you are trying to run the command from within python! These are all shell commands … prompt is usually a string ending in “% ” …

  31. Hi,

    While updating it to 3.3 and after running the above command, I’m getting following error message:

    rm: /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pydoc: No such file or directory
    rm: /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python: No such file or directory
    rm: /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pythonw: No such file or directory
    rm: /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python-config: No such file or directory

  32. Step 2 is not correct. This is:

    sudo rm -R /System/Library/Frameworks/Python.framework/Versions/2.7
    sudo mkdir /System/Library/Frameworks/Python.framework/Versions/2.7
    sudo cp -r /Library/Frameworks/Python.framework/Versions/2.7/* System/Library/Frameworks/Python.framework/Versions/2.7

    If you delete the /Library/Frameworks/Python.framework/Versions/2.7 folder you break a lot of things like:

    #easy_install #pip

  33. >>sudo cp …
    Keeping Python in two locations?
    The issue is, that those unix scripts 2to3, pip, easy_install still link into /Library/Frameworks/… instead of /System//Library/Frameworks/…
    I guess, with that fixed, things should work out just fine.

  34. Thanks a lot with your helf.

    Usefull the lines above. With this I can fix the root cern’s to use pyROOT.

    Wish you a good new year.



  35. Thanks for this important, clarifying post. However, even with the comment from “dependencies” above, I found that updating to 2.7.9 in this way broke pip and easy_install.

    Happily, instead of deleting the old version, I saved it. I STRONGLY suggest doing the same, i.e. instead of:
    sudo rm -R /System/Library/Frameworks/Python.framework/Versions/2.7

    sudo mv /System/Library/Frameworks/Python.framework/Versions/2.7 /System/Library/Frameworks/Python.framework/Versions/2.7-old

    This renames the “2.7” directory to “2.7-old”. You can reverse the two names to move it back, if you delete or rename the new 2.7 directory first (I renamed it to 2.7.9-broken).

    Hope there is a way to upgrade to 2.7.9 and have it all work! (I am considering but am a little gun-shy at the moment)

  36. Here is video proof of it working perfectly. @Baa is correct there needs to be a better way to system link the files. Also renaming the old version seems like good idea as well:

    Here is a updater a made works on 10.6-10.10, I will update to use the rename instead seems like a great idea. Hopefully when the system links can be resolved I can include that as well:

  37. Found the solution create a symbolic link back to /Library after updating no folder moving or copying required:

    sudo rm /System/Library/Frameworks/Python.framework/Versions/2.7
    sudo ln -s /Library/Frameworks/Python.framework/Versions/2.7 /System/Library/Frameworks/Python.framework/Versions/2.7

  38. >>I found that updating to 2.7.9 in this way broke pip and easy_install.

    Interestingly those tools ship with a hardcoded MagicLine pointing to the original python interpreter – rather than using “/usr/bin/env python” or something. To fix this, adapt that MagicLine to the new location, too, i.e. change “#!/Library/…” to “#!/System/Library/…”. I edited all the scripts located in “/System/Library/Frameworks/Python.framework/Versions/2.7/bin” and seem to have no trouble since.

  39. If your IDLE is crashing when you upgrade to 3.4 see if you can run the following command in terminal:

    python /System/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/idlelib/

    If it works you should see a message that your tk version is unstable. Follow the prompts to fix it. This was also causing issues with matplotlib which uses Tkinter. Hope it helps.

  40. This is a very helpful article. I had a problem for a long time which was when I typed python on the terminal the Python version that ran was 2.7.6 and when I opened IDLE the python version that ran was 2.7.9. So all the packages that I ran using sudo port install .. worked fine for the IDLE version and any packages that I installed using .py scripts on the terminal got installed for 2.7.6. It was a big mess and it was only after going through this post I was able to figure out how to install any packages from .py scripts for 2.7.9 version. Thank you for the detailed post!

  41. I have two lines in my path:

    # Setting PATH for Python 2.7
    # The orginal version is saved in .bash_profile.pysave
    export PATH

    # Setting PATH for Python 2.7
    # The orginal version is saved in .bash_profile.pysave
    export PATH

    Do I need to delete one of them?

  42. My pip and easy_install are no longer working. I get errors like:

    `IOError: [Errno 13] Permission denied: ‘/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/’`


    `python version 2.7.9 can’t run /usr/bin/easy_install. Try the alternative(s):

    /usr/bin/easy_install-2.6 (uses python 2.6)
    /usr/bin/easy_install-2.7 (uses python 2.7)`
    Anyone know how I recover from this ? I wish I hadn’t followed the remove step of this article.

  43. This is a great article! However, after so pip and easy_install were not found. Could you point me to how to set that up?

  44. I successfully removed the python 2.7 from my Mac. However, I cannot set up the python 3.4 as default. When i run the script with the IDLE above, it says “SyntaxError: multiple statements found while compiling a single statement”. And I cannot use terminal to open python (i think it’s because the newly installed python is not default). Does anyone have any idea about this problem?

  45. Just upgraded my old snow leopard system to python 2.7.9 – couldn’t have done without these instructions. brilliant thank you.

  46. So this is great and all, but what do you do exactly if you have the program installed on your OS X 10.6.8 device, and the program itself refuses to open? The only thing that does open is an error message that says “Pycharm has Unexpectedly Closed.”
    Any ideas, I’ve got a loophole, but it slows my computer way way down and makes it difficult to navigate between programs (esp. Safari). Which is frustrating because I need this program for a class, and all of my assignments and instructions are online. It makes coding very irritating and takes much longer than it should.
    Any ideas?

  47. Thank you so much for this decent guide. Proper job!


  1. mac os ??python | ??? - […] ????????????? […]

Submit a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>