Home  >  Q&A  >  body text

vim - mac command line does not execute

After executing source ~/.zshrc in the command line, you can only use the cd command. Other ls, vim... cannot be used, and the error zsh: command not found: ls will be reported. How to solve this?

黄舟黄舟2734 days ago708

reply all(5)I'll reply

  • 漂亮男人

    漂亮男人2017-05-16 16:38:05

    Your PATH must be misconfigured somewhere. Post the relevant lines in .zshrc that configure PATH

    reply
    0
  • 某草草

    某草草2017-05-16 16:38:05

    Check whether your zsh is installed and see if there is a .zshrc file in the path

    reply
    0
  • 天蓬老师

    天蓬老师2017-05-16 16:38:05

    Check the $PATH variable

    $ echo $PATH
    /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
    

    For example, the directory where ls is located:

    $ whereis ls
    /bin/ls
    

    If it does not exist in $PATH/bin/, the ls command will not be recognized.

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-16 16:38:05

    Put a copy of the path in your default bash into zsh as well

    cat .zshrc
    vim .zshrc 
    增加:
    export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 16:38:05

    The person above is right, there is a problem with PATH.
    .zshrc generally adds directories to PATH:

    export PATH=$PATH:$YOUR_FOLDER/bin

    If you accidentally write:

    export PATH=$YOUR_FOLDER/bin

    The situation you mentioned will occur.

    reply
    0
  • Cancelreply