How to edit PATH on Mac

Sometimes, you have to edit the global path on your Mac to do something. For beginners, it is quite hard to find the file that contains the path. That is the topic of this post.

First, you can check what the current PATH by echo $PATH. Then, echo $SHELL to find what is your current SHELL. I am using zsh and this is what you see.

How to edit PATH on Mac

If you have never changed your SHELL, it would be bash.

If you are using bash, the target file is ~/.bash_profile. If you are using zsh, you need to modify ~/.zshrc. In practice, you would better do not touch the .zshrc file. You are suggested to add the PATH into ~/

That is it.