mac 每次都要source 才生效

 自己在 ~/.bash_profile 中配置环境变量, 可是每次重启终端后配置的不生效.需要重新执行 : $source ~/.bash_profile后,才会生效。

 

 自己是在bash中配置的环境变量,而当前系统是使用的是shell

 查看当前使用的shell: 终端输入:echo $SHELL

 输出是/bin/zsh,说明使用的是zsh

 

 解决办法:

 在.zshrc文件加中添加source ~/.bash_profile,方法如下:

vim ~/.zshr

 按i进入编辑模式,加入source ~/.bash_profile后,esc,再输入:wq保存退出

posted @ 2023-12-12 17:07  流水飘香  阅读(789)  评论(0)    收藏  举报