MacOS – How to remove one old python installation from a system with multiple (non-system) installations of python

macospython

Disclaimer

First, let me get the obvious out of the way: I have not touched the system-bundled Python. I know it’s important to leave it alone. I have, in fact, done exactly that. ☺


Background

The Python official releases for Mac have a very handy Installer. (It’s the Installer’s brilliance that allowed me to put newer versions of Python on my system without screwing up the system-bundled version. Thanks, Pythonistas!)

Now, my primary Python installation is 2.7. Since it is the last 2.x release, that’s fine.

However, I was curious to learn about Python 3 as well, so I installed it. And it plays perfectly nicely with Python 2. In fact, Python 3 is opt-in, which is just what I wanted. “Works as advertised.”

Now, the weird part…

I have 2 installed versions of Python 3! The installers for Python 3.1 and Python 3.2 both installed to separate locations. So, now I have Python 3.1 hanging around and I’m never planning to use it. And since the installer is awesome (I’m not being sarcastic; I’m really impressed, especially since most programming languages require compilation from source), it also creates entries in /Applications with some handy utilities.

But since I have installed a newer Python 2 and two versions of Python 3, this means I now have:

  • /Applications/Python 2.7,
  • /Applications/Python 3.1, and
  • /Applications/Python 3.2

Help Wanted!

I just want to ditch Python 3.1.

And I want to be very thorough about it. No forgotten directories buried under /Library/* (or whatever).

Anybody know how to do this?

Best Answer

From python docs noting that they seem to have hard coded 2.5 instead of the current version and is not that well written

What you get after installing is a number of things:

A MacPython 2.5 folder in your Applications folder. In here you find IDLE, the development environment that is a standard part of official Python distributions; PythonLauncher, which handles double-clicking Python scripts from the Finder; and the “Build Applet” tool, which allows you to package Python scripts as standalone applications on your system.

A framework /Library/Frameworks/Python.framework, which includes the Python executable and libraries. The installer adds this location to your shell path. To uninstall MacPython, you can simply remove these three things. A symlink to the Python executable is placed in /usr/local/bin/.

so remove

/Applications/Python 3.1
/Library/Frameworks/Python.framework/Versions/3.1
/usr/local/bin/python31 (I use a different install so this might be python3.1 or similar)