在 mac 终端中找不到命令

时间:2021-02-01 01:48:12

标签: macos terminal command zsh

当我打开终端时,它突然显示

/Users/mine/.rvm/scripts/rvm:12: command not found: uname
/Users/mine/.rvm/scripts/rvm:29: command not found: ps

然后我尝试运行 flutter devices 或其他类似 git status 的东西,它说 zsh: command not found: flutter 有办法解决吗?

[编辑]

Last login: Mon Feb  1 09:43:50 on ttys000
/Users/umsi06/.rvm/scripts/rvm:12: command not found: uname
/Users/umsi06/.rvm/scripts/rvm:29: command not found: ps
umsi06@umsi06s-MacBook-Pro ~ % ls
zsh: command not found: ls
umsi06@umsi06s-MacBook-Pro ~ % PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
umsi06@umsi06s-MacBook-Pro ~ % export PATH
umsi06@umsi06s-MacBook-Pro ~ % exec /bin/zsh
umsi06@umsi06s-MacBook-Pro ~ % ls
zsh: command not found: ls
umsi06@umsi06s-MacBook-Pro ~ % 

[第二次编辑]

+/Users/umsi06/.zshrc:1> export PATH=/Users/umsi06/bin:/usr/local/bin:/Users/umsi06/Documents/platform-tools:/Users/umsi06/Downloads/flutter/bin
+/Users/umsi06/.zshrc:5> export PATH=/Users/umsi06/bin:/usr/local/bin:/Users/umsi06/Documents/platform-tools:/Users/umsi06/Downloads/flutter/bin:/Users/umsi06/.rvm/bin
+/Users/umsi06/.zshrc:6> export ANDROID_HOME=/Users/umsi06/Library/Android/sdk
+/Users/umsi06/.zshrc:7> export PATH=/Users/umsi06/Documents/platform-tools
+/Users/umsi06/.zshrc:8> export ANDROID_HOME=/Users/umsi06/Library/Android/sdk
+update_terminal_cwd:5> local url_path=''                                       
+update_terminal_cwd:9> local i ch hexch LC_CTYPE=C LC_ALL=''
+update_terminal_cwd:10> i = 1

1 个答案:

答案 0 :(得分:0)

看起来您弄乱了 PATH 变量。 (您当前的 PATH 不包含公共实用程序所在的任何位置,因此所有命令都不是。)

你可以试试:

PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
export PATH

另一种方式是你可以“重置”zsh,指定shell的完整路径:

exec /bin/zsh

exec /usr/bin/zsh