美文网首页
Mac下 .bash_profile 和 .zshrc 两者之间

Mac下 .bash_profile 和 .zshrc 两者之间

作者: 迷失的信徒 | 来源:发表于2021-10-25 21:50 被阅读0次
问题

在设置Flutter环境变量的时候,开始是设置在.bash_profile文件当中,但关闭当前窗口之后重新运行flutter doctor;它会报错zsh: command not found: flutter

原因

.bash_profile中修改的环境变量只对当前窗口有效,修改完.bash_profile之后记得在终端输入source ~/.bash_profile使之生效。
.zshrc在电脑每次自启时都会生效(永久有效),修改完之后在终端输入source ~/.zshrc使之生效。

解决方案

1、直接在.zshrc中添加修改环境变量。
2、在.zshrc添加source .bash_profile,这样以后不管你以后不小心添加到.bash_profile中的环境变量也会始终有效。

转载参考:https://www.cnblogs.com/nickchen121/p/10269302.html

相关文章

网友评论

      本文标题:Mac下 .bash_profile 和 .zshrc 两者之间

      本文链接:https://www.haomeiwen.com/subject/knmsaltx.html