Uninstalling Python on macOS requires caution, as the system Python (in /usr/bin/python) is used by macOS and should not be removed. Doing so can break system functionality.
How to Safely Remove User-Installed Python Versions
The method depends on how Python was installed:
If installed via Homebrew (most common for users):
Open Terminal and run:
brew uninstall pythonTo remove all Python versions managed by Homebrew:
brew uninstall --ignore-dependencies pythonClean up leftover files:
brew cleanup brew doctor
If installed via the official Python.org installer (e.g.,
Python 3.14):Open Finder, go to Applications, and drag the Python 3.14 folder to the Trash.
Remove remaining files:
sudo rm -rf /Library/Frameworks/Python.framework/Versions/3.14 sudo rm -rf /Applications/Python\ 3.14Remove symlinks in
/usr/local/bin:cd /usr/local/bin ls -l | grep '../Library/Frameworks/Python.framework/Versions/3.14' | awk '{print $9}' | xargs sudo rm
If installed via pyenv or MacPorts:
Use the respective tool’s uninstall command:
pyenv uninstall 3.14or
sudo port uninstall python314
Important Warnings
Never delete
/usr/bin/pythonor/usr/bin/python3— these are part of macOS and critical to system stability.Removing Python may cause issues with system tools, Xcode, or third-party apps that depend on it.
If you're unsure how Python was installed, check with:
which python3 python3 --versionThis reveals the installation path.
Final Recommendation
Do not uninstall Python unless absolutely necessary. It’s safe to leave it installed, as it uses minimal space and doesn’t interfere with daily use. If you need a clean environment, use virtual environments instead.
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
Answer from zayadur on Stack Overflow 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
# The version of Python that you want to delete
python_version_number=3.10
sudo rm -rf /Library/Frameworks/Python.framework/Versions/${python_version_number}/
sudo rm -rf "/Applications/Python ${python_version_number}/"
cd /usr/local/bin && ls -l | grep "/Library/Frameworks/Python.framework/Versions/${python_version_number}" | awk '{print $9}' | sudo xargs rm
Videos
Is Python installed on Mac by default?
Do I need to uninstall the version of Python that came with my Mac?
How do I uninstall Python from Terminal?
Edit/Resolved: Xcode installs python3 into usr/bin. Link: https://discuss.python.org/t/updating-python-under-usr-bin-python3/13020/6
tldr; Can someone walk me through how to delete python exec files contained in /usr/bin on Mac and explain why these would exist in the first place? TIA
I'm on Mac Sonoma (17.4) and trying to cleanup my files, dependencies, etc. I'm pretty new to programming in general and anyway I made big a mess with having a bunch of versions of python installed. Had a version in homebrew, bunch of python files in anaconda, and python installed "normally" in my applications.
So, I deleted all of them to start fresh. However, when I "pip3 list" and "where python3". There is still python a version in /usr/bin and I'm unsure why or how to delete it. They are two exec files, one for pip and one for python3.
I currently have 3.10x and 3.11.x and I want to know how can I uninstall the older version of python I have ?
also for future how do I upgrade from 3.11.2 to say 3.11.4 or 3.12.x
So, I ended up removing all python installations, and reinstalling things via Homebrew.
which python--->/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonDelete the entire Python.framework directory from/Library/Frameworks.which python3--->/usr/local/bin/python3Delete the entire python3 directory.I was a bit nervous about the symlinks. I initially renamed the ones that were obviously going to cause me trouble. It turns out that was unnecessary. Instead, just use:
$ brew doctor Warning: Broken symlinks were found. Remove them with 'brew prune': /usr/local/bin/python-32 /usr/local/bin/python2-32 /usr/local/bin/python2.7-32 /usr/local/bin/python2_DNU /usr/local/bin/python_DNU /usr/local/bin/pythonw-32 /usr/local/bin/pythonw2-32 /usr/local/bin/pythonw2.7-32So,
brew prune(orbrew cleanup --prunein newer versions of Homebrew) worked perfectly. It removed all of the above symlinks.Reinstall python and python3 via homebrew. All done.
At no time did I touch the python installation located within the /System folder.
Oh, and to be clear. The answer to the original question is
Yes, you can trust the old references, as written! That guidance is still valid.
My Python version was 3.6, I wanted to upgrade to 3.7 (In case you have similar requirements). I am using macOS version 10.12.6 and simply uninstalling and re-installing worked for me:
brew uninstall --ignore-dependencies python3
Then:
brew install python3
and done:
python3
Python 3.7.2 (default, Jan 13 2019, 12:51:54)
[Clang 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
There’s no need to uninstall python3 if you remove the executable from your path. Just keep calling the older version or use a tool like pyenv to juggle which is preferred if you don’t like or care to control your path.
You may have multiple versions of Python 3.x installed on your Mac. To uninstall all of them, first check which are installed:
brew list | grep python
Let's say you have 3.9 and 3.7 installed. To remove 3.9, run this command:
brew uninstall [email protected]
To remove 3.7, just replace 3.9 with 3.7 above.
rmtree verb is not available in the default install of Homebrew.
MacBook-Pro:~ admin$ brew rmtree python3
Error: Unknown command: rmtree
You can use uninstall verb as:
MacBook-Pro:~ admin$ brew uninstall python3
Uninstalling /usr/local/Cellar/python/3.6.5... (5,102 files, 102.9MB)
MacBook-Pro:~ admin$ python3
-bash: python3: command not found
MacBook-Pro:~ admin$ python
Python 2.7.10 (default, Oct 6 2017, 22:29:07)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
However, rmtree can be installed by executing the following:
$ brew tap beeftornado/rmtree
$ brew rmtree <package>
Using rmtree, one can cleanly and completely remove a package installed from Homebrew, along with all of its dependencies.
I've been trying all the commands to remove python or even just to check what version it was, but it just keeps giving me 'invalid syntax'
Please let me know because I have stopped using python and I no longer need it.