Mac OS X
Python 2.7
Uninstall Python
Macintosh
Software Removal

How to uninstall Python 2.7 on a Mac OS X 10.6.4?

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

On Mac OS X 10.6.4, the right way to remove Python 2.7 depends on how it was installed. That distinction matters because Apple shipped a system Python, and deleting the wrong framework can break tools that the operating system expects to find.

Identify Which Python You Are Removing

Before deleting anything, check whether python points to Apple’s system interpreter or to a copy installed from python.org or another package source. On older macOS versions, the system copy usually lives under /System/Library, while a manual installer often places files in /Library/Frameworks and /usr/local/bin.

bash
1which python
2python --version
3ls -l /usr/bin/python
4ls -l /usr/local/bin/python

If the interpreter comes from /usr/bin/python, treat it as part of the operating system. If it comes from /usr/local/bin/python and resolves into /Library/Frameworks/Python.framework/Versions/2.7, that is usually the removable installation.

A good inspection step is to list the framework contents directly:

bash
ls -l /Library/Frameworks/Python.framework/Versions
ls -l /System/Library/Frameworks/Python.framework/Versions

The first path is commonly associated with installer-based Python versions. The second path is the one you generally should not touch.

Safely Remove a Python.org Installation

If Python 2.7 was installed from the official installer, the main files are typically stored in three places:

  • '/Library/Frameworks/Python.framework/Versions/2.7'
  • '/Applications/Python 2.7'
  • symlinks in /usr/local/bin

Remove them in that order so you can inspect what remains after each step.

bash
sudo rm -rf /Applications/Python\ 2.7
sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7

After removing the framework, delete the symlinks that pointed to it. On older systems, there may be several commands such as python, pythonw, pydoc, idle, and 2to3.

bash
ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework'

Delete only the links that resolve to the removed framework:

bash
1sudo rm -f /usr/local/bin/python
2sudo rm -f /usr/local/bin/python2.7
3sudo rm -f /usr/local/bin/pydoc
4sudo rm -f /usr/local/bin/pydoc2.7
5sudo rm -f /usr/local/bin/idle
6sudo rm -f /usr/local/bin/idle2.7
7sudo rm -f /usr/local/bin/2to3
8sudo rm -f /usr/local/bin/smtpd.py

You may not have every one of those links. The safe approach is to inspect first and remove only the entries that clearly belong to the deleted installation.

Remove User-Level Packages and Configuration

Uninstalling the interpreter does not automatically remove packages or user-specific configuration. If you want a clean machine, check the per-user library directories as well.

bash
rm -rf ~/Library/Python/2.7
rm -rf ~/.python-eggs
rm -rf ~/.pip

If you used easy_install or an early pip, there may be scripts or site-packages left behind in user-owned locations. Deleting those is optional, but it prevents confusion later when you install Python 3.

Verify the Result

After removal, confirm that your shell no longer resolves to the deleted interpreter.

bash
which python
python --version

If which python now returns /usr/bin/python, the system interpreter is still present, which is expected on older macOS releases. If the shell still points at /usr/local/bin/python, inspect that link again because a leftover symlink may still exist.

You can also search for remaining Python 2.7 items in the framework and application locations:

bash
find /Library/Frameworks -maxdepth 3 -name '2.7' 2>/dev/null
find /Applications -maxdepth 1 -name 'Python 2.7*' 2>/dev/null

If You Need a Cleaner Replacement

The real goal is often not removal by itself, but replacing Python 2 with a maintainable setup. On a legacy machine, the safest pattern is to keep the system Python untouched and install newer interpreters in isolated locations. Even on old systems, a version manager or a dedicated /usr/local installation is easier to reason about than modifying Apple-provided files.

For project work, virtual environments are a better long-term answer than aggressive system cleanup. They avoid conflicts between the operating system, old scripts, and any newer runtime you install later.

Common Pitfalls

The biggest mistake is deleting /System/Library/Frameworks/Python.framework. That path belongs to the operating system, not to a user-managed Python installation.

Another common problem is removing the framework but forgetting /usr/local/bin symlinks. That leaves broken commands in the shell and makes it look like Python is still installed even when the binaries are gone.

Users also often delete package directories first and assume the interpreter has been removed. In practice, packages, framework files, and shell links are separate parts of the installation.

Finally, be careful with blanket rm -rf commands copied from the web. On an old system, one mistyped path can remove unrelated software or personal files.

Summary

  • First determine whether Python 2.7 is a system copy or a removable installer-based copy.
  • Remove only the python.org style locations under /Library/Frameworks, /Applications, and matching /usr/local/bin symlinks.
  • Leave /System/Library/Frameworks/Python.framework alone on Mac OS X 10.6.4.
  • Clean optional user-level package directories only if you want a full reset.
  • Verify the result with which python and python --version after every step.

Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.