從 macOS Catalina 版開始,您的 Mac 將使用 zsh 作為默認(rèn)登錄 Shell 和交互式 Shell。您還可以在較低版本的 macOS 中將 zsh 設(shè)置為默認(rèn) Shell。
運(yùn)行chsh -s /bin/zsh之后,發(fā)現(xiàn)flutter的命令不能用了,這是因?yàn)榍袚Q了shell執(zhí)行工具
單次解決辦法:
這種方法,只對(duì)當(dāng)前終端窗口有效,關(guān)閉之后無效了
vim ~/.bash_profilesource ~/.bash_profile
永久解決方法:
-
vim ~/.bash_profile; - 復(fù)制里面的內(nèi)容;
- 新開命令窗口;
- 創(chuàng)建新文件:
vim ~/.zshrc - 粘貼內(nèi)容;
- 退出保存;
- 執(zhí)行一下這個(gè)文件:
source ~/.zshrc
補(bǔ)充
查看當(dāng)前shell用的是哪一個(gè)
chsh
切換shell
-
chsh -s /bin/zsh切換為zsh -
chsh -s /bin/bash切換為bash