Search code examples
pythonmacospath-variables

macOS: How to change PATH environment variable?


OS:macOS Big Sur 11.1

I have uninstalled python3.8 and python3.9

but my echo $PATH gives:

screenshot of results

I tried to modify path variables by vi ~/.bash_profile, but bash_profile doesn't exist.

I did touch .bash_profile and

export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"

then source ~/.bash_profile. But after restarting the terminal, echo $PATH has not changed...

How can I delete /Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/3.9/bin: from my path variables? And which file did this message come from? Is it because I didn't uninstall python completely?


Solution

  • bash is no longer the default shell in macOS. The default shell is now zsh; to append to PATH, you should modify ~/.zshrc or ~/.zprofile.