path_helper¶
Wie kommt unter OS X eigentlich der $PATH
zustande?
Die /etc/profile
führt beim Start den path_helper
aus:
cat /etc/profile
# System-wide .profile for sh(1)
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
man path_helper
spricht folgendes:
$PATH
wird zusammengesetzt aus folgenden Dateien:/etc/paths
und alles unter/etc/paths.d/
Eine Zeile == ein Ordner
- “… should not be invoked directly”.
“It is intended only for use by the shell profile.”
Also: Am besten dort ansetzen:
$ ls /etc/paths.d
Home MacGPG2
$ cat /etc/paths.d/*
/Users/user/bin
/Users/u/bin
/usr/local/MacGPG2/bin
Homebrew steht hier an erster Stelle:
$ cat /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
Die Vorteile: Funktioniert für alle Benutzer, und alle Shells.
Der Check gibt folgendes:
$ /usr/libexec/path_helper -s
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/user/bin:/Users/u/bin:/usr/local/MacGPG2/bin"; export PATH;