打开终端,复制粘贴如下内容,运行解决:
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
Mac下关闭终端时系统默认此命令是不生效的,因此每次重启后会发现还是老样子。
这可以通过修改环境变量定义文件来修改环境变量:
$cd # 到用户根目录下
$ls -a # 查看所有文件,包含隐藏的文件
$vi .bash_profile # 修改环境变量定义文件
想要确认是否真的修改了路径:
$ echo $PATH # 查看当前的搜索路径