1

I'm on Mac and I've just moved from Bash to Zsh with Oh-my-zsh.

It's all working fine, except my $PATH is now missing several entries, for example the path to the nodeJS binaries.

The workaround I have used for the moment is to copy my $PATH from bash and paste it in .zshrc, which is not really clean.

Is there a better way to have my $PATH on zsh have all the entries it has on bash?

  • It depends, what file is setting those paths for $PATH in bash? – Patrick Oct 28 '16 at 1:15
  • I have been trying to find out, without success.. Is there a way I can find out? – Thierry J. Oct 28 '16 at 2:11
1

In general, shells have some basic configuration files in /etc on most Unix like systems. Important file name patterns include anything mentioning the shell name, and for bash at least, the file "profile". These same files might be rendered as ., such os .cshrc, .bashrc and .profile, etc.

Bash, when started as a login shell, sources /etc/profile, if that file exists. After reading that file, it sources for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order. In those files, the PATH can be altered, but it can also source other programs to set paths. If it's an interactive shell, but not a login shell, it will source ~/.bashrc.

In the case of the Mac, inspection of /etc/profile reveals a program called "path_helper", which man page reveals that it likes to store extra paths in /etc/path.d.

That pattern, .d, is also widely used, and is a good place to look for further configuration files.

  • Unfortunately I haven't been able to find anything in this folder, or any folder with .d, that relates to the paths I'm missing... – Thierry J. Nov 7 '16 at 0:04
  • I added a bit to this. Look through those files as well. – Hack Saw Nov 8 '16 at 0:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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