commands not found on zsh

前端 未结 16 1653
梦毁少年i
梦毁少年i 2020-12-04 06:30

I am using the z Shell (zsh) instead of the default bash, and something wrong happen so that all commands who used to work are no longer recognized:

<         


        
16条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-04 07:05

    If you like me, you will have two terminals app, one is the default terminal with bash as the default shell and another iTerm 2 with zsh as its shell. To have both commands and zsh in iTerm 2 from bash, you need to do the following:

    On iTerm 2, go to preferences (or command ,). Then go to the profile tab and go down to command. As you can see on the picture below, you need to select command option and paste path of zsh shell (to find the path, you can do which zsh).

    At this point you will have the zsh as your default shell ONLY for iTerm 2 and you will have bash as the global default shell on default mac terminal app. Next, we are still missing the commands from bash in zsh. So to do this, you need to go on your bash (where you have your commands working) and get the PATH variable from env (use this command to do that: env | grep PATH).

    Once you have that, go to your iTerm 2 and paste your path on "send text at start" option.

    export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin && clear
    

    Just reopen iTerm 2 and we are done!

提交回复
热议问题