Python is a popular programming language and framework for applications on modern operating systems (including macOS). However, Python is often split into two distinct versions—Python 2 and Python 3.

Python 2 used to be included in macOS, but it’s no longer supported for security reasons. Only Python 3 is officially supported. While you can install it on your Mac alongside Python 2, having the two versions installed together isn’t recommended.

Table of Contents
    How to Completely Uninstall Python on Your Mac image 1

    You may not need Python at all, or you may just want the latest version installed. If you’re unsure, it’s a good idea to know how to completely uninstall Python on your Mac. To remove Python from your Mac, follow the steps below.

    Identifying Python Versions on Your Mac

    Depending on your version of macOS, you might have two (or more) versions of Python installed. These are usually split between versions of Python 2 and Python 3. Python 2 was included by default in macOS up until it was removed in Monterey 12.3 and later versions.

    If you’re going to remove Python from your Mac, you need to identify which version is installed first. You can do this by following the steps below.

    Using Terminal

    1. Open Terminal on your Mac by pressing Command + Space to bring up the Spotlight Search bar.
    2. In Spotlight, type Terminal and press Enter.
    How to Completely Uninstall Python on Your Mac image 2
    1. Type and run python –version in the Terminal to see the Python 2 version installed on your Mac (if any). If this doesn’t work, there’s no Python 2 installed.
    2. Next, type and run python3 –version in the Terminal to see if Python 3 is installed on your Mac and, if so, what version it is.
    How to Completely Uninstall Python on Your Mac image 3

    Keep in mind that if you have multiple Python installations, these commands will display the version for the Python installation associated with the current path configuration.

    Checking Applications Folder

    You can also check for any manual Python installations in the Applications folder. To do this, follow these steps.

    1. Open Finder on your Mac.
    2. Navigate to the Applications folder by clicking on the Go menu in Finder and then selecting Applications from the drop-down menu.
    How to Completely Uninstall Python on Your Mac image 4
    1. Look for any Python-related application folders, such as “Python 3.x” or “Python 2.x“, where x denotes a specific version number (eg. Python 3.11).
    How to Completely Uninstall Python on Your Mac image 5

    Remember that various Python versions can co-exist on your Mac computer, so it’s important to identify which versions are installed before attempting to perform any modifications.

    Manually Uninstalling Python from macOS

    Removing Python manually from your Mac will require you to remove files from two different locations. This includes the framework files (the core files needed for Python applications to run) and the Python executable files themselves.

    Removing Python Framework Files

    To manually uninstall Python framework files from your Mac, follow the steps below.

    1. Open Finder, press Go > Go to Folder, then type and select /Library/Frameworks/Python.framework in the pop-up box.
    How to Completely Uninstall Python on Your Mac image 6
    1. If you have multiple versions of Python installed, identify the specific version folder you wish to uninstall, such as Python 2 or Python 3.x.x, in the Versions sub-folder.
    How to Completely Uninstall Python on Your Mac image 7
    1. Before proceeding with deletion, make sure you’ve backed up any essential data or projects you may have developed using this version of Python.
    2. Next, open the Terminal app.
    3. In the Terminal, type and run the following command to remove the Python folder, replacing /Path/To/Python.framework with the actual path to the Python folder you wish to delete, and using extreme caution not to type in the wrong folder path: sudo rm -rf /Path/To/Python.framework (eg. sudo rm -rf /Library/Frameworks/Python.framework/Versions/3.9/).
    4. You might be prompted to enter your administrator password to execute this command. Enter your password and confirm the deletion to proceed.
    How to Completely Uninstall Python on Your Mac image 8

    Removing Python from the /usr/local/bin Directory

    Python installation typically adds executables to the /usr/local/bin folder. If you’ve removed Python files using the steps above, you’ll need to remove any matching executables or syslinks for Python (the Terminal shortcuts to it) to avoid compatibility issues later.

    1. To remove these executables, open Terminal, and list all Python-related files in the /usr/local/bin directory by entering the following command in Terminal: ls -l /usr/local/bin | grep ‘python’
    2. This command will display all files that contain the word ‘python.’ Identify the files associated with the version of Python you wish to uninstall.
    • To remove these files, enter and run the following command in Terminal, replacing file_name with the actual name of the file you want to delete and using extreme caution before executing the command: sudo rm -rf /usr/local/bin/file_name
      How to Completely Uninstall Python on Your Mac image 9

    At this point, all of the relevant files for your chosen Python version will be removed. Repeat these steps to remove each Python-related file associated with the specific version you’re uninstalling. You can also repeat these steps for other Python versions that you wish to remove.

    Using Homebrew to Uninstall Python

    Homebrew is a popular, third-party package management tool for macOS that you can use from the Terminal. You’ll often use it if you want to install third-party Mac applications without using the App Store.

    If you’ve installed Python on your Mac using Homebrew, you can easily uninstall it using the same tool by following these steps.

    1. Open the Terminal app on your Mac.
    2. In the Terminal, type and run the brew list command. This will list any installed packages that you’ve previously installed via Homebrew (eg. python@3.11 for Python 3.11).
    How to Completely Uninstall Python on Your Mac image 10
    • To uninstall these Python packages, type and run the brew uninstall python_package command in the Terminal, replacing python_package with the appropriate package name you identified in the previous step (eg. brew uninstall python@3.9).
    • After removing the packages, type and run brew cleanup python_package to remove any additional (and now unnecessary) files, replacing python_package with the correct name (eg. brew cleanup python@3.9).
      How to Completely Uninstall Python on Your Mac image 11

    At this point, the version of Python that you installed using Homebrew has been removed. If you’ve installed multiple versions, however, you may need to repeat these steps to remove those versions next.

    Using Python on your Mac

    If you need to completely uninstall Python on your Mac, the steps above will help you get the job done. That said, don’t be afraid to give Python a try if you’re looking to create your own applications, as it’s one of the easiest programming languages to learn.

    A good way to expand your Python knowledge is to try out new Python packages. You can do this by installing Python PIP, a package installer that allows you to easily install and manage third-party modules.

    You’ll need to be comfortable using the Terminal app, however. You can try out some important Terminal commands to manage your macOS system next.