How to remove a directory from $PATH on MacOS

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. You can read more about this here.