背景:在剛拿到mac 的時候,使用了默認的bash,因爲工做須要在電腦上安裝了maven,在~/.bash_profile 文件中添加了maven的配置以下apache
$ 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項目用的也很順手。vim
前不久,看到了oh my zsh,相比於默認的bash 真的叫高端大氣上檔次(具體怎麼安裝oh my zsh 你們能夠到官網查看安裝說明)。bash
安裝以後的某一天maven
$ mvn clean
zsh: command not found: mvn
由於安裝zsh,~/.bash_profile就不會被執行,解決辦法有兩種:zsh
vim ~/.zshrc 將你要配置到環境變量配置到該文件中便可
vim ~/.zshrc 將 source ~/.bash_profile 添加到末尾,這樣~/.bash_profile配置的環境變量一樣有效
而後 source ~/.zshrc便可
變量