问题
今天想通过adb命令查看手机运行时的一些信息,在macOS下,打开终端后输入adb 出现
zsh: command not found: adb。但是在之前已经配置好环境变量了,我的配置如下:
但是在终端中使用adb命令每次都需要source .bash_profile之后就可以找到adb了,
否则就提示 zsh: command not found: adb
解决方案:
1、查看根目录下是否有.zshrc文件,如果没有就新建一个
touch .zshrc
2、打开这个文件
open -e .zshrc
3、在后.zshrc文件里后面添加
source ~/.bash_profile 然后command+s进行保存。
4、保存,在终端输入
source .bash_profile 这样每次终端启动会先加载~/.zshrc,在加载~/.zshrc的最后加载了~/.bash_profile。