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
Just add:
source ~/.bash_profile
to .zshrc
step 1:
vim ~/.zshrc
step 2:(Add at the end of the file)
source ~/.bash_profile;
step 3 : (Save changes in Vim)
:wq!
step 4:(Execution shell)
> source ~/.bash_profile
Try below steps:
Open terminal and run command vi ~/.zshrc
Add below lines in file:
export M2_HOME=/Users/<username>/Downloads/apache-maven-3.6.3
export PATH=${M2_HOME}/bin:${PATH}
export PATH
Save file successfully
Open another terminal instance & run command mvn -version
It should work!
Combining other answers I got adb working on mac and zsh appending these two path lines to .zshrc:
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# this are for Android Studio adb:
export PATH=~/Android/sdk/tools:$PATH
export PATH=~/Android/sdk/platform-tools:$PATH
copy this thing into your .zshrc file :
export PATH=$PATH:/Applications/apache-maven/bin
I had a similar problem after installing oh-my-zsh, but for adb command.
Looks like the PATH
is shortened when oh-my-zsh is installed. I solved it using following steps.
Open the .zshrc
file
sudo nano ~/.zshrc
Look for # User configuration
Un-comment the following line:
export PATH="/usr/bin:/bin:/usr/sbin:/sbin:$PATH"
Save the file.
source ~/.zshrc
Give this one a try for other similar command not found errors.