背景:在刚拿到mac 的时候,使用了默认的bash,由于工作需要在电脑上安装了maven,在~/.bash_profile 文件中添加了maven的配置如下

$ cat ~/.bash_profile
export M2_HOME=/Users/yingmi/software/apache-maven-3.6.0
export PATH=$PATH:$M2_HOME/bin
平时通过Terminal 使用 maven clean install来构建maven项目用的也很顺手。

前不久,看到了oh my zsh,相比于默认的bash 真的叫高端大气上档次(具体怎么安装oh my zsh 大家可以到官网查看安装说明)。

安装之后的某一天

$ mvn clean
zsh: command not found: mvn
因为安装zsh,~/.bash_profile就不会被执行,解决办法有两种:

vim ~/.zshrc 将你要配置到环境变量配置到该文件中即可
vim ~/.zshrc 将 source ~/.bash_profile 添加到末尾,这样~/.bash_profile配置的环境变量同样有效
然后 source ~/.zshrc即可

相关文章:

  • 2022-12-23
  • 2021-06-07
  • 2021-12-13
  • 2021-11-09
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-03
  • 2021-07-01
  • 2021-06-21
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案