I recently installed zsh and oh-my-zsh in my Mac. Now when I try to run a maven command from the terminal, I am getting the following error.
$ mvn install
zs
vi ~/.zshrc
add source ~/.bash_profile to ~/.zshrc file, after the line source $ZSH/oh-my-zsh.sh
open up a new terminal tab and execute mvn, and it will start working.
$ in PATH=$PATH:M2_HOME/binsource ~/.zshrc to take the settings into effect instantly. Best solution work for me
Open Finder-> go to folder /Users/ /usr/local/bin
open .zshrc with TextEdit
.zshrc is hidden file so unhide it by command+shift+. press
delete file content and type
export PATH=~/usr/bin:/bin:/usr/sbin:/sbin:$PATH
and save
now
zsh: command not found Gone
As mentioned by @4ae1e1 in his comment, $ have to be added before M2_HOME while referring it in the PATH variable, as follows:
export M2_HOME=/Applications/apache-maven-3.3.3
export PATH=$PATH:$M2_HOME/bin/
Once added, as others suggested, source the ~/.zshrc file.
Actually, .bash_profile is for /bin/bash shell, for your /bin/zsh shell, the file is called .zprofile, you should do the same thing in .zprofile as in .bash_profile
➜ ~ mvn
zsh: command not found: mvn
step 1:
vim ~/.zshrc
step 2:(Add at the end of the file)
source ~/.bash_profile;
step 3:(Execution shell)
> source ~/.bash_profile
➜ / mvn
[INFO] Scanning for projects...
.......