1

When I first install zsh(oh-my-zsh), the ~/.zshrc file has the following lines by default -

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

What is the author trying to say here? Bash is the default shell on MAC and Linux, so yes, we are coming from BASH. So is he trying to say that, just uncomment the second line? Or he is saying to do some other setup that I should look for on the internet?

Anyone who is well versed is welcome to explain how should I configure the $PATH the right way, when I first install zsh on my mackbook (macOS-11).

  • 1
    Maybe my answer to another question might give you some further information on how to set your PATH variable effectively. – mpy Feb 22 '18 at 19:28
0

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

Now what the author is trying to say - 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
  • I will be using brew for installing packages. There are some recommendations out there - on how to setup $PATH variable. Brew creates symlinks when it installs packages. If $PATH is not set right, it can create some headaches when using brew installed packages. What do you think is the best approach from that perspective? – Akshayraj Kore Feb 22 '18 at 18:32
  • Well, I've used brew with zsh(not oh-my-zsh) and I've had no problems apart from when using packages that already exist in the system(like python for instance). The best approach will be to do whatever brew documentation suggests. If you ever run into issues, you can always modify your PATH to resolve. – man0v Feb 22 '18 at 18:45

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.