macOS PATH清理
macOS PATH
macOS PATH来源复杂,通过不同文件加载,这里指出其中几个主要路径。
用户定义
用户可以通过以下文件自定义PATH
- ~/.bash_profile , ~/.bashrc , ~/.profile (用户bash shell启动时加载);
- ~/zshrc , ~/.zprofile (用户zsh shell加载);
- ~/.csh_profile 等 ~/.*profile;
删除PATH相关语句或添加修改PATH的语句即可
系统级自动加载
- /etc/paths, /etc/paths.d/* ;
- /etc/bashrc, /etc/bashrc_Apple_Terminal;
- /etc/csh.cshrc, /etc/csh.login;
- /etc/zshrc, /etc/zprofile, /etc/zshrc_Apple_Terminal;
- /etc/profile, /etc/rc.common;
第三方软件加载
- 一般位于 /private/etc/paths.d/ 中;
- /private/etc/paths;
- /private/etc/bashrc, /private/etc/bashrc_Apple_Terminal;
- /private/etc/csh.cshrc, /private/etc/csh.login;
- /private/etc/zshrc, /private/etc/zprofile, /private/etc/zshrc_Apple_Terminal;
- /private/etc/profile, /private/etc/rc.common;