Removing Python 3.8 entry in Mac OS PATH

Viewed 10727

PROBLEM DESCRIPTION

I'm setting up a new MacBook and decided to jump too fast into downloading Python 3.8. I downloaded it from the website https://www.python.org/ before realizing it's better practice to do so with homebrew.

GOAL - Remove Python 3.8 from my PATH to later install with Homebrew

I cleared Python 3.8 from my filesystem thanks to this page https://nektony.com/how-to/uninstall-python-on-mac, but the path the Version 3.8 is still in my PATH variable.

Typing echo $PATH in my terminal (zsh) returns /Library/Frameworks/Python.framework/Versions/3.8/bin along with other paths. Does anyone know how I can remove this path? It no longer exists in my filesystem so it's pointing to nothing.

WHAT I HAVE TRIED

I have checked all the following files using nano and they all do not have the export command which would place it in the path in the first place.

Files checked: /etc/profile /etc/bashrc ~/.bash_profile ~/.bash_login ~/.profile ~/.bashrc

MY ENV

I am running a macbook pro with Catalina (10.15.4) and using zsh as my terminal.

Any help is appreciated, thanks a lot!!

3 Answers

Found the solution! Through running grep {subset of the path you're trying to remove} . (don't forget the period at the end), I found all places where that path was found on my computer. That brought me to seeing that the ./.zprofile file was exporting the Python 3.8 path. I removed it from that file, saved it and restarted my Terminal. Now, the path is gone and I am happy

If you check what is stored in each variable using the set command, you might see Python somewhere there. To check what's in there, type set > ~/Documents/set.txt to view the contents. You can then open set.txt in your Documents directory to see the contents. Then, if you go back to Terminal, you can type PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin or whatever you would like to set it to. In conclusion, all you need to use is the PATH=<desired path> to set the value.

Check /etc/paths and /etc/paths.d/* and remove the relevant paths.

Related