fish > set -S PATH
$PATH: not set in local scope
$PATH: set in global scope, exported, with 10 elements
$PATH[1]: length=14 value=|/usr/local/bin|
$PATH[2]: length=8 value=|/usr/bin|
$PATH[3]: length=4 value=|/bin|
$PATH[4]: length=9 value=|/usr/sbin|
$PATH[5]: length=5 value=|/sbin|
$PATH[6]: length=42 value=|/Applications/Wireshark.app/Contents/MacOS|
$PATH[7]: length=75 value=|/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources|
隐藏 8 9 10
$PATH: not set in universal scope
几个已知的 Bash Startup Files
里找过了,木有~
1
magicfan 2020-12-03 10:41:08 +08:00
[How to use /etc/paths.d to add executable files to my path?]( https://apple.stackexchange.com/questions/128897/how-to-use-etc-paths-d-to-add-executable-files-to-my-path)
[Use /etc/paths or /etc/paths.d to add items to the PATH in macOS Sierra?]( https://unix.stackexchange.com/questions/342574/use-etc-paths-or-etc-paths-d-to-add-items-to-the-path-in-macos-sierra) The paths in `/etc/paths.d/` are added to the path by `/usr/libexec/path_helper`, which is run from `/etc/profile`, `/etc/zprofile`, and `/etc/csh.login`. 可执行 `man path_helper` 查看相关说明。 以下为 macOS ZSH 下的 PATH 变量: ``` $ echo $PATH | awk 'BEGIN{RS=":"} {print}' # 省略在 ~/.zshrc 中追加在 PATH 前面的配置 /usr/local/bin /usr/bin /bin /usr/sbin /sbin /opt/X11/bin /Library/Apple/usr/bin /Applications/Wireshark.app/Contents/MacOS # 省略在 ~/.zshrc 中追加在 PATH 后面的配置 ``` 前面 5 个为 `/etc/paths` 中预定义的路径;后面 3 个为 `/etc/paths.d` 中配置的环境变量: ``` $ ls -1 /etc/paths.d/ 100-rvictl 40-XQuartz Wireshark ``` 每个文件里面包含一行可执行路径,被 `/etc/profile` 或 `/etc/zprofile` 执行 path_helper 加载到 PATH 环境变量中: ``` $ cat /etc/paths.d/40-XQuartz /opt/X11/bin $ cat /etc/paths.d/100-rvictl /Library/Apple/usr/bin $ cat /etc/paths.d/Wireshark /Applications/Wireshark.app/Contents/MacOS ``` |