方式1 通过 Homebrew 安装
1. 安装brew

安装方法:命令行输入/usr/bin/ruby-e"$(curl-fsSL

https://raw.githubusercontent.com/Homebrew/install/master/install)" 回车(这里有提示目录不存在,要创建需要按return键,如果用的windows键盘,就是回车键)

它的用法

brew update 更新brew;

brew install {应用名,如git} 安装软件

brew cask install{应用名,如git} 也是下载安装,与上面的区别,请查看https://www.zhihu.com/question/22624898

更多用法请 brew help

2. 用brew安装android tools

命令:brew cask install android-platform-tools

测试是否正常安装

adb devices

方式二:手动安装(需要配置环境变量)
1、下载并安装IDE (android studio)

人性化的安装,直接点击下一步下一步就可以完成安装啦

2、配置环境

在安装完成之后,将android的adb工具所在目录加入环境变量里面去

在终端中输入sudo vim ~/.bash_profile,打开 .bash_profile文件。按i进入输入模式,在文件内容的末尾加入以下内容:

#Setting PATHfor Android ADB Tools

export PATH=${PATH}:/Users/xxx/Library/Android/sdk/platform-tools

export PATH=${PATH}:/Users/xxx/Library/Android/sdk/tools

这里面的xxx根据自己实际的用户名称进行修改

然后点击 esc ,输入 :wq 回车(保存并退出文本)。

添加完成后输入:source ~/.bash_profile应用该变更。

3、测试

输入:adb version

Android Debug Bridge version1.0.39Revision 3db08f2c6889-android

Installed as /Users/howie/Library/Android/sdk/platform-tools/adb

输入:adb devices

List of devices attached* daemon not running. starting it now at tcp:5037** daemon started successfully *

到这里说明android adb命令已经可以正常使用了。

 

 

mac版 命令行执行adb命令报错“zsh: command not found: adb”
 

原因分析:
字面意思是相关命令没有没有找到,其实就是bash shell 以及zsh shell 是两种读取系统环境变量(使用adb的前提是你肯定已经在bash的 .bash_profile 已经配置相关android tool的环境变量了,从而才能使用adb命令)
然而在使用zsh shell的时候,你并没有把相关的环境变量的配置设置到 .zshrc 中(功能上类似bash 的.bash_profile)
解决办法:
1.命令行输入 open .zshrc 回车(没有的话新建。touch .zshrc)
2.打开的文件中找到# User configuration部分,紧贴其后添加source ~/.bash_profile

3.点击文件的完成,命令行再输入source .zshrc 回车

在执行adb命令成功解决。


原文链接:https://blog.csdn.net/csdndouniwan/article/details/94164263

更多相关文章

  1. MacPro 10.13.6 编译 android-8.1.0_r53
  2. android事件薄-不能安装APK的一种原因
  3. Android(安卓)Studio安装genymotion插件并运行
  4. debug.keystore文件不存在解决办法
  5. Win10系统中怎么安装Android(安卓)Studio软件?
  6. 快应用 QuickApp:配置开发环境 和 第一个工程 HelloWorld
  7. android framework下载学习
  8. No content provider found for permission revoke: file:///dat
  9. android 显示16色的图片:输入用颜色矩阵,显示对应的16色位图

随机推荐

  1. 安卓Android开发连载系列高级课
  2. Android中通过友盟统计上传自定义错误详
  3. AndroidStudio使用常见问题(实时更新)
  4. Android自定义属性,attr format取值类型
  5. Android中相机拍照并获取路径
  6. Android——实现在 Service 中播放音乐
  7. android使用webview加载H5页面
  8. c/c++ android 平台交叉编译 {ERROR: Fai
  9. Android(安卓)Studio中统一管理版本号引
  10. Android注册界面设计