[Mac] 解決 zsh: command not found : XXX

zsh: command not found:xxx

表示Mac環境變數沒設定好

查看環境變數

查看整體環境變數

printenv
SHELL=/bin/zsh

也可以直些輸入 echo $SHELL 來查看

zsh 加入 環境變數 path舉例 (GVM 安裝 go)

安裝 GVM 安裝go

zsh < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
source /Users/<User name>/.gvm/scripts/gvm
vim ~/.zshrc
...
...
#最底下加入gvm環境變數路徑
source /Users/<User name>/.gvm/scripts/gvm

可以用一行完成添加環境變數

[[-s“/Users/<User name>/.gvm/scripts/gvm”]] && source“/Users/<User name>/.gvm/scripts/gvm”

執行確認gvm安裝成功

$ gvm versionGo Version Manager v1.0.22 installed at /Users/<User name>/.gvm

--

--

工程師斜槓山岳攝影師,

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store