在 ~/.bash_profile 中配置环境变量后,每次新打开的终端窗口必须执行 $source ~/.bash_profile 环境变量才生效。
发现zsh加载的是/private/etc/zshrc文件,而 ‘zshrc’ 文件中并没有定义任务环境变量。
现有两种解决办法:
1.在/private/etc/zshrc文件最后,增加一行:
source ~/.bash_profile
![](https://img2020.cnblogs.com/blog/773362/202106/773362-20210603221617538-2003431268.jpg)
2.修改 /etc/profile文件,在末尾添加全局变量
ring1992 2021-06-03 22:19 原文
在 ~/.bash_profile 中配置环境变量后,每次新打开的终端窗口必须执行 $source ~/.bash_profile 环境变量才生效。
发现zsh加载的是/private/etc/zshrc文件,而 ‘zshrc’ 文件中并没有定义任务环境变量。
现有两种解决办法:
1.在/private/etc/zshrc文件最后,增加一行: