⚠️ WARNING: macOS comes with a system Python installation in /usr/bin/python3 that should NOT be removed as it's required for system functionality. Only remove Python versions you've manually installed.
Please read the end of 5.1.1 for official insight: https://docs.python.org/3/using/mac.html#installation-steps
Legacy Python
The previous edit for this question suggested removing /Library/Frameworks/Python.framework/Versions/2.x/bin/python as a way of completely removing Python. This flexibility has since changed with newer macOS updates.
Identify Your Python Installations
Before removing anything, determine which Python installations exist and where they're located:
# List all Python installations which -a python python3 # Check Python versions python3 --version # Find installation locations ls -l /opt/homebrew/bin/python* ls -l /usr/local/bin/python* ls -l /usr/bin/python*
For Homebrew Python
# Uninstall Python brew uninstall [email protected] # Remove orphaned files brew cleanup # List any broken symlinks, etc. brew doctor
For Python.org installer
# Remove the application sudo rm -rf /Applications/Python\ 3.x # Check for framework files ls -la /Library/Frameworks/Python.framework/Versions/ # If found, remove the specific version sudo rm -rf /Library/Frameworks/Python.framework/Versions/3.x # Check for and remove symbolic links # For Intel Macs: cd /usr/local/bin ls -l | grep '../Library/Frameworks/Python.framework/Versions/3.x' | awk '{print $9}' | xargs rm -f # For Apple Silicon: cd /usr/local/bin ls -l | grep '../Library/Frameworks/Python.framework/Versions/3.x' | awk '{print $9}' | xargs rm -f # Check for user-specific packages ls -l ~/Library/Python/ # Remove if needed rm -rf ~/Library/Python/3.x/
For pyenv-managed Python
# List all installed Python versions pyenv versions # Show the current active version pyenv version # Uninstall a specific version pyenv uninstall 3.x.y # Check pyenv installation location ls -la ~/.pyenv/versions/ # Remove pyenv shims and rehash pyenv rehash # If you want to completely remove pyenv itself # For Homebrew installation: brew uninstall pyenv # For manual installation: rm -rf ~/.pyenv # Don't forget to remove pyenv initialization from your shell profile # (.bash_profile, .zshrc, etc.)
Clean Up Remaining Files
# Remove Python cache files find ~/ -name "__pycache__" -type d -exec rm -rf {} + find ~/ -name "*.pyc" -delete # Check for any remaining Python-related directories ls -la ~/Library/Application\ Support/ | grep -i python ls -la ~/Library/Caches/ | grep -i python