What is Python? It is one of the most famous programming languages. While college students use it when learning to code, data scientists use it to crunch numbers. Setting up and learning Python on Mac is quite difficult, and who knows why you may stop finding this programming language necessary any longer. You have learned the text editors and passed the best courses so that the information will remain in your head anyway. Now, if you are sure there is no room for Python on your Apple computer any longer, consider this guide as your personal helper on the way to fully deleting Python.
If you do not wish to download and use a third-party cleaner with the built-in uninstaller, you can always remove Python manually. The question is whether such way comforts you. Be aware that it may take some time, unlike a cleaning app. Besides, you risk missing some elements, so keep your eyes open.
Those Mac owners who search for the ways to safely remove all versions of Python and shoot for a clean install after that can find this article useful.
How to Remove Python from Mac: Universal Approach
Before moving to the specific versions of the famous programming language, look at the overall picture of how to remove Python. The primary step is preventing the application from running. Otherwise, you will not be able to delete it on Mac. Several methods exist to quit the app:
- Right-click on Python on the Dock. Pick the Quit button
- Launch Python and select Quit from the Apple menu
- Launch Activity Monitor and pick the process named Python. Push the “X” button and pick Quit in the pop-up window. Here, you may also choose Force Quit if Python refuses to stop form the first trial
Once you close the app and associated processes, it is time to perform an uninstallation. There are three basic ways to get rid of Python on Mac.
Method #1: Erase Python from Launchpad
- You will need to enter Python in the Launchpad’s search box.
- Pick and keep holding the application’s icon until it begins to wiggle.
- Pick and keep holding the application’s icon until it begins to wiggle.
Those Mac owners who installed Python via the App Store having OS X Lion or up can benefit from using this method.
Method #2: Eliminate Python Using Trash
- Launch Finder. Pick Applications.
- Locate and pick Python. Drag its icon to the Trash bin and leave it there.
- Right-click the Trash icon and select Empty Trash.
Method #3: Uninstall Python from Finder
A good old Finder will help to clean various libraries to prevent any associated leftovers. Once you toss away Python to the Trash, mind that some of the related terms such as caches and logs remain in the system. These elements take some share of the space. Unfortunately, the only way to make sure nothing’s left on Mac is through manual method, which might be rather time-consuming unless you use a third-party solution.
You will need to take a look at the Preferences folder (~/Library/Preferences). Launch Finder, move to the menu bar to launch the Go menu. Pick the entry: Go to Folder… and type the path of the Application Support folder: ~/Library. Observe the list of folders you will need to look through to detect any components left by Python:
- /Library/Preferences/
- /Library/Application Support/
- /Library/Caches/
Uninstall Python 2.7 on Mac
Imagine that you would like to totally erase Python 2.7 from your Apple computer. You successfully erased the entry from PATH and return your .bash_profile. However, you still need to get rid of all catalogs, files, symbolic links, and records that were created by Python 2.7 installation package. So, what sort of configuration files should you remove to uninstall Python 2.7 completely?
Taking into account most of the Mac owners use macOS Sierra today, the authors included the method to get rid of Python 2.7 on this operating system.
Read this brief step-by-step instruction to have a general understanding of how to erase Python on masOS Sierra and High Sierra:
- Switch off your Apple computer.
- Clean the monitor with a lens cleaner or napkin.
- Switch on your MacBook. You may see no sense in the previous step, but sooner or later, you will have to do an external cleaning as well.
- Launch Terminal.
- To do so, go to Finder in the Dock. Click Go. Pick the Utilities Double-click Terminal.
- The alternative option is to apply Spotlight. Did you notice a magnifying glass in the upper-right corner? Command+space will do the same. Enter Terminal in the search field to let it show up.
- Enter “sudo.” Let it know who the boss is.
- Enter “caffeinate” to prevent the target Mac from sleeping.
- It is time to discover that Python programming language/app. Watch out: the smallest typo in the code may lead to irreversible
You can either drag-and-drop the corresponding icon to the Trash or discover the associated files and processes to uninstall the app completely. On the whole, a user will need to:
- Delete the structure of Python 2.7: sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7
- Erase the app catalogs: sudo rm -rf “/Applications/Python 2.7”
- Eliminate the related links in /usr/local/bin that point to this specific version of Python:
ls -l /usr/local/bin | grep ‘../Library/Frameworks/Python.framework/Versions/2.7’ ls -l /usr/local/bin | grep ‘../Library/Frameworks/Python.framework/Versions/2.7’
Then, enter the following command to delete the entire list of links:
cd /usr/local/bin/
ls -l /usr/local/bin | grep ‘../Library/Frameworks/Python.framework/Versions/2.7’ | awk ‘{print $9}’ | tr -d @ | xargs rm
Complicated and Simple Ways to Uninstall Python 3
If you have been using Python 3 on your Mac for a while, it makes sense that you might want to replace it with another programing language or version. Just like in case of version 2.7, it is important to start with erasing the associated files and symbolic links. Besides, make sure the application is not running.
Mind that the offered commands will eliminate all Python versions available on your Mac that were installed with packages. As for the one provided by the system, it will remain untouched. So, apply this command:
sudo rm -rf /Library/Frameworks/Python.framework
cd /usr/local/bin
ls -l . | grep ‘../Library/Frameworks/Python.framework’ | awk ‘{print $9}’ | xargs sudo rm
Keep in mind that deleting the app folder is also a must. In this formula, x.y is the software’s version number (e.g., 3.4):
sudo rm -rf “/Applications/Python x.y”
Finally, you may download and install a special cleaner from the third-party developer. It has all the pros an average Mac owner needs: from detecting application’s leftovers and other junk to completely uninstalling the software. A cleaning tool may simply clean the entire operating system/hard drive if you wish. Of course, the software will ask about the user’s opinion before erasing any items once and forever. It will take just a couple of minutes, and it is, perhaps, the easiest and fastest way to clean up and speed up an Apple computer of any type.