解決macOS Catalina(10.15)預設zsh shell出現zsh command not found

今天macOS Catalina(10.15)正式版發佈,做了不少改動。其中一項是終端機預設shell提示大家換成zsh:

1
2
3
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.

換成zsh之後,安裝過的某些程式指令會出現:

1
zsh: XXX command not found

環境變數改變,要把原本的bash profile搬過來。開啟終端機輸入:

1
vim ~/.zshrc

編輯一個新的.zshrc檔,加入內容:

1
source ~/.bash_profile

存檔後重開終端機,應該不會再出現zsh command not found。

參考文章: