MacOS – My Mac has Python3 and 2.7 installed. How to uninstall Python3 but keep 2.7

macospythonterminal

I installed python3 a few days ago, but I need to use version 2.7 for school. When I run in terminal, it shows like below:

RandeMacBook-Pro:~ ranshu$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
RandeMacBook-Pro:~ ranshu$ which python3
/usr/local/bin/python3

I tried to uninstall python3 in Finder but my Mac still used python3.

How do I cleanly uninstall version 3?

Best Answer

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.