A tiny POSIX-sh script to remove Python versions installed via the official python.org macOS installers.
It’s safe by default (dry run). Add --yes to actually delete.
- Finds versions under:
/Library/Frameworks/Python.framework/Versions/<ver> - Removes matching app folders:
/Applications/Python <ver>(IDLE, bundled scripts) - Deletes
/usr/local/binsymlinks that point into that framework - Forgets related pkgutil receipts (so macOS no longer lists them)
- Apple’s system Python in
/usr/bin - Homebrew Pythons in
/opt/homebrewor/usr/local/opt pyenv/Conda environments
Save the script as uninstall_python_org.sh, then:
sh uninstall_python_org.shsh uninstall_python_org.sh --yessh uninstall_python_org.sh --yes --versions 3.10 3.11Tip: You can use
bashorzshtoo — it’s POSIX compatible.
After running, you’ll see what was removed (or would be removed in dry-run).
Verify your default Python:
which python3
python3 --versionIf you’re moving to Homebrew Python:
brew install python@3.12
brew link --overwrite python@3.12- macOS (works with the default
/bin/sh) sudoprivileges (only required when actually deleting with--yes)
- List framework versions in
/Library/Frameworks/Python.framework/Versions - Optionally filter by
--versions - Remove
/Applications/Python <ver> - Remove
/usr/local/binsymlinks pointing into that framework version pkgutil --forgetthe receipts for that version
Everything is echoed in dry-run mode so you can see exactly what will happen.
- “command not found: sh” — use
bashorzsh:bash uninstall_python_org.sh --yes
- Permission denied — you’ll be prompted for
sudoon first deletion. - Python still points to old path — check your shell startup files for custom PATH entries and remove stale overrides.
MIT — do whatever you like, no warranty.
Use at your own risk. Read the script before running; it’s short and intentionally conservative.