简体   繁体   中英

How to remove a directory from $PATH on MacOS

I want to remove a directory from my PATH directories.

When I run echo $PATH I get the following response:

/Users/USERNAME/opt/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

The anaconda3 should have been gone long ago but somehow is still there. However when I run which python I get /usr/bin/python I'm very confused as to what's going on

First determine which shell you are using by running the following from the command line.

ps -p$$ -ocommand=

If the output is zsh you should make changes to your $PATH variable in ${HOME}/.zshrc .

If the output is bash you should make changes to your $PATH variable in ${HOME}/.bash_profile . There is a caveat here though, if your shell is invoked as an interactive non-login shell then changes should be made to your ${HOME}/.bashrc as your ${HOME}/.bash_profile should only have the following contents, if [ -f ~/.bashrc ]; then. ~/.bashrc; fi if [ -f ~/.bashrc ]; then. ~/.bashrc; fi if [ -f ~/.bashrc ]; then. ~/.bashrc; fi . You can read more about this here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM