mac終端執(zhí)行flutter提示command not found: flutter據(jù)官方說,從 macOS Catalina 版開始,您的 Mac 將使用 zsh 作為默認(rèn)登錄 Shell 和交互式 Shell。您還可以在較低版本的 macOS 中將 zsh 設(shè)置為默認(rèn) Shell。
單次解決辦法(這種方法,只對(duì)當(dāng)前終端窗口有效,關(guān)閉之后無效了)
source ~/.bash_profile
永久解決辦法
1.執(zhí)行:【open ~/.zshrc 】
open ~/.zshrc
2.如果 提示文件不存在,則執(zhí)行:【vim ~/.zshrc 】新建一個(gè)新文件。
vim ~/.zshrc
3.再執(zhí)行【open ~/.bash_profile 】
open ~/.bash_profile
4.把 bash_profile 中的內(nèi)容copy到 zshrc 文件中,保存:【:wq回車】。
5.再使用source命令重新加載一下:【source ~/.zshrc】,下次再編輯這個(gè)文件就可以直接執(zhí)行:【open ~/.zshrc】
source ~/.zshrc
6.運(yùn)行【flutter -h 】看生效沒有