OS X 10.8.2: zsh runs path_helper for non-login shells

Number:rdar://13103029 Date Originated:28-Jan-2013 10:33 PM
Status:Closed Resolved:Duplicate
Product:Mac OS X Product Version:10.8.2 (12C60)
Classification:Other Bug Reproducible:Always

The zsh startup file /etc/zshenv alters $PATH using /usr/libexec/path_helper. Since *every* instance of zsh sources /etc/zshenv, $PATH is altered even by non-login shells (e.g., when one runs "zsh" from the command-line).

Steps to Reproduce:

1. Open a new Terminal window or tab.
2. Prepend a new directory to the $PATH environment variable. For example, run "export PATH=/usr/local/sbin:${PATH}"
3. Run a zsh shell that only sources /etc/zshenv and prints $PATH. This can be done by running:

    /bin/zsh -o NO_RCS -c 'echo $PATH'

Expected Results:

Non-login shells should not alter $PATH; they should respect the value of $PATH that they inherit from the parent environment. An instance of zsh started from the command line should therefore have the same value of $PATH as the parent shell had.

Actual Results:

The non-login zsh sources /etc/zshenv, which evals "/usr/libexec/path_helper -s", which changes $PATH.


I believe all versions of OS X with zsh have this issue, although I currently cannot verify.


A similar issue probably exists for bash, since /etc/bashrc also evals path_helper.

The simple solution is to run path_helper in /etc/zprofile, which is only sourced by login shells.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!