How should paths in /etc/paths.d get added to $PATH?
None of the paths I have in the /etc/paths.d
directory are being added to $PATH
in any of the shells on my High Sierra system. Presumably there’s supposed to be something in some file that says to look in /etc/paths.d
when a shell starts; what is that something and where should it be?
Ideally I’d like to know a proper way (i.e. not some weird hack that technically solves the problem but will cause more problems down the line, because that’s almost certainly how I got into this mess) to get $PATH
to use the contents of /etc/paths.d
for at least bash and zsh.
/usr/libexec/path_helper
is used to build PATH
from the default in /etc/paths
and the entries in /etc/paths.d
(see man path_helper
for details). By default this is called in /etc/profile
which is executed for each sh
/bash
/zsh
style login shell.
On my system /etc/profile
looks like this
# System-wide .profile for sh(1) and friends
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi