安装轻量adb工具

2022-03-03 澡盆

如果想通过电脑对安卓设备进行一系列操作,例如刷机、安装apk或修改系统文件等,adb工具基本是标配了。

安装工具

1、根据自己的系统到这里下载对应工具:SDK平台工具

2、将解压出来的platform-tools放到任意位置,由于本人是macOS,习惯放在/usr/local/下。

环境配置

由于自macOS Catalina版本之后,zsh取代bash成为了终端的默认shell工具,所以配置方法略有差异。

打开终端,看看窗口的标题,-zsh对应zsh,-bash对应bash,自行判断即可。

终端是zsh shell

运行命令:

cd
open -e .zprofile

若提示没有.zprofile文件就新建一个。

touch .zprofile
open -e .zprofile

在弹出的文本编辑器里输入:

export PATH=${PATH}:/usr/local/platform-tools

如果之前在bash下配置过很多环境,可以将.bash_profile加入到.zprofile文件里。

#Enabale bash profile
source .bash_profile

保存后用命令使环境立即生效即可。

source .zprofile

终端是bash shell

运行命令:

cd
open -e .bash_profile

如果提示没有.bash_profile文件就新建一个。

touch .bash_profile
open -e .bash_profile

在弹出的文本编辑器里输入:

export PATH=${PATH}:/usr/local/platform-tools

保存后用命令使环境立即生效即可。

source .bash_profile

最后运行一下adb命令,显示出版本信息就👌了。

想切换shell工具?

切换到bash:

chsh -s /bin/bash

切换到zsh:

chsh -s /bin/zsh

切换后需要新开窗口才能生效。