Command not found - Oh-My-Zsh

前端 未结 12 909
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-25 11:54

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         


        
相关标签:
12条回答
  • 2020-12-25 12:28
    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.

    0 讨论(0)
  • 2020-12-25 12:33
    • First, as 4ae1e1 pointed out, you missed the $ in PATH=$PATH:M2_HOME/bin
    • Second, don't forget to run source ~/.zshrc to take the settings into effect instantly.
    0 讨论(0)
  • 2020-12-25 12:34

    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

    0 讨论(0)
  • 2020-12-25 12:38

    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.

    0 讨论(0)
  • 2020-12-25 12:38

    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

    0 讨论(0)
  • 2020-12-25 12:45

    Question:

    ➜ ~ mvn

    zsh: command not found: mvn

    Answer:

    step 1:

        vim ~/.zshrc

    step 2:(Add at the end of the file)

        source ~/.bash_profile;

    step 3:(Execution shell)

        > source ~/.bash_profile

    You can use mvn :

    ➜ / mvn

    [INFO] Scanning for projects... .......

    0 讨论(0)
提交回复
热议问题