失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > mac报错“zsh:command not found:adb”

mac报错“zsh:command not found:adb”

时间:2018-11-18 21:50:38

相关推荐

mac报错“zsh:command not found:adb”

前言

不知道操作了哪里,在使用“adb devices”时忽然出现了“zsh:command not found:adb”。网上搜索了一下,操作了一番,解决。再次呢,也做个记录已经安装好了android SDK,具体的方法,先自行百度吧,后续有时间,我会写篇文章的

adb 配置 .bash_profile

(一)在根目录下查看是否有 .bash_profile 文件

进入根目录:cd ~查看隐藏文件:ls -la

bogon :: ~ » cd ~bogon :: ~ » ls -latotal 504drwxr-xr-x+ 74 hello staff 2368 1 20 14:49 .drwxr-xr-x 6 rootadmin 192 7 26 09:39 ..drwxr-xr-x 3 hello staff96 5 25 .3T-rw-r--r-- 1 hello staff 360 5 2 -rwxrwxrwx@ 1 hello admin 923 1 20 11:42 .bash_profile-rw-r--r--@ 1 hello staff 576 1 25 .bash_profile.pysave

(二)打开 .bash_profile 文件

如果可以查看到 .bash_profile文件,输入命令:

open .bash_profile -e

如果查看无 .bash_profile文件,输入命令:

open .bash_profile

(其实就是一个“-e”的参数的区别,已存在的话不加“-e”会显示进程终止,无法编辑文件)

(三)编辑 .bash_profile 文件

在 .bash_profile中输入如下内容后保存

export PATH="/Users/hello/Library/Android/sdk/platform-tools/:$PATH"

(注:我的电脑名字叫“hello”)

(四)配置 .zshrc文件

根目录下查看是否有 .zshrc 文件如果已经存在文件,输入“ open .zshrc -e”;如果不存在,输入“ open .zshrc ”在打开的文件内填写如下内容:

source ~/.bash_profile

(五)执行source命令

在终端中输入如下命令,使其立即生效

source ~/.zshrc

(六)终结,再输入“adb devices”试试吧

参考文章:

liyihan333

如果觉得《mac报错“zsh:command not found:adb”》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。