What is the right way to set the $PATH variable in .zshrc

Solution 1:

There is nothing wrong in setting your path by uncommenting the second line. However, having that path enabled by default in oh-my-zsh will, at the very least, be annoying. Why? You could have already set up your own PATH and then this will break functionality you've explicitly set up.

The author is trying to say that bash environments do not have $HOME/bin and /usr/local/bin in their default PATH, however, both places are quite popular for packets(/usr/local/bin is where anything you install lives in UNIX systems like FreeBSD while $HOME/bin is usually for user installed packets that were installed without root privileges).

Lastly, you can set up your PATH the best way that fits your needs. A good way will be to start with examining what's currently in your PATH and adding any extra paths to it as you find fit

export PATH=/some/path:$PATH