macos 环境变量 source 重启后失效
macos 环境变量一般我们都保存到
~/.bash_profile中, 并且使用source ~/.bash_profile令它生效, 但重启后环境变量就失效了, 需要重新执行source ~/.bash_profile,因此本文给出解决方案。
博主博客
查看当前系统使用的 shell(macos 自带 zsh)
可以在终端输入下面命令查看当前使用的 shell
echo $SHELL
结果会输出 /bin/zsh, 说明当前使用的是 zsh
查看 zsh 版本
zsh --version
在 zsh 中配置 .bash_profile
1.编辑 .zshrc 文件
vim ~/.zshrc
2.在末尾加入应用 .bash_profile 配置
source ~/.bash_profile
3.Shift+:,输入 :wq 进行保存退出
4.重启试试
MacOS环境变量持久化
1947

被折叠的 条评论
为什么被折叠?



