MacOS下出现-bash: 命令: command not found的解决方法

MacOS下出现-bash: 命令: command not found的解决方法

1.在命令行输入:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

2.进入当前用户的home目录:

cd ~/

3.创建bash_profile执行命令:

touch .bash_profile

4.打开并编辑bash_profile 执行命令:

open .bash_profile

5. 在打开的记事本中会显示之前配置过的path, 进行保存 全选: command+s 或者不放心的话 选中记事本 文件-保存 保存之后没提示 直接关掉就可以。

6. 此时在命令行中输入更新命令(命令行一直不要关):

source .bash_profile

到此就结束 重启终端命令就可以了,亲测有效!

原文地址:https://www.cnblogs.com/rxbook/p/14411003.html