在 ~/.bash_profile 中配置環境變量后,每次新打開的終端窗口必須執行 $source ~/.bash_profile 環境變量才生效。
發現zsh加載的是/private/etc/zshrc文件,而 ‘zshrc’ 文件中並沒有定義任務環境變量。
現有兩種解決辦法:
1.在/private/etc/zshrc文件最后,增加一行:
source ~/.bash_profile

2.修改 /etc/profile文件,在末尾添加全局變量