- 创建 ~/.bash_profile文件
- vim ~/.bash_profile文件,进行环境变量的配置
- 完了之后使用zsh终端发现配置的环境变量还是无效,每次打开zsh都需要手动source ~/.bash_profile
- 解决方案:修改zsh的配置文件,让其在每次启动的时候来读取~/.bash_profile里面的配置。
vim ~/.zshrc
# 在文件的最后面加上
source ~/.bash_profile
- source ~/.zshrc 使其立即生效
vim ~/.zshrc
# 在文件的最后面加上
source ~/.bash_profile